<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic python script to create logon banner in ExtremeSwitching (EXOS/Switch Engine)</title>
    <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-script-to-create-logon-banner/m-p/99426#M22327</link>
    <description>&lt;P&gt;Hello I have tried creating multiple python scripts to create a logon banner for a EXOS Switch. I can do it manually via serial easily, But when I try to automate using a script it keeps failing for the banner comes up blank. What I am doing wrong? Below is a example script of I have been using. I would appreciate any help or feedback. if anyone has an example script that would be very useful as well. I have removed the IPs, username and passwords.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;# Import the netmiko library for SSH connections&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from netmiko import ConnectHandler&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Define the devices list with the host, device_type, username, and password&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;devices = [&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "host": "",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "device_type": "extreme_exos",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "username": "",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "password": ""&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; },&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "host": "",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "device_type": "extreme_exos",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "username": "",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "password": ""&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Define the banner string to be displayed before login&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;banner = "WARNING: This device is part of the Network. Access to this device is restricted to authorized personnel only. Unauthorized access or use of this device may result in disciplinary action, civil liability, or criminal prosecution. All activity on this device is subject to monitoring and recording. By accessing this device, you consent to such monitoring and recording and agree to comply with the Alonso Network Acceptable Use Policy (AUP). If you do not agree, disconnect immediately."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Loop through each device in the devices list&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for device in devices:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; # Create a SSH connection to the device&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ssh_conn = ConnectHandler(**device)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; # Print the device hostname&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; print(f"Connected to {ssh_conn.find_prompt()}")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; # Send the configure banner before-login command with the banner string&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ssh_conn.send_config_set(f"&lt;/SPAN&gt;&lt;SPAN&gt;configure banner before-login\n{banner}\n")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; # Save the configuration&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ssh_conn.save_config()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; # Close the SSH connection&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ssh_conn.disconnect()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; # Print a confirmation message&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; print(f"Banner configured and saved on {device['host']}")&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 26 Feb 2024 09:57:53 GMT</pubDate>
    <dc:creator>robot71</dc:creator>
    <dc:date>2024-02-26T09:57:53Z</dc:date>
    <item>
      <title>python script to create logon banner</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-script-to-create-logon-banner/m-p/99426#M22327</link>
      <description>&lt;P&gt;Hello I have tried creating multiple python scripts to create a logon banner for a EXOS Switch. I can do it manually via serial easily, But when I try to automate using a script it keeps failing for the banner comes up blank. What I am doing wrong? Below is a example script of I have been using. I would appreciate any help or feedback. if anyone has an example script that would be very useful as well. I have removed the IPs, username and passwords.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;# Import the netmiko library for SSH connections&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from netmiko import ConnectHandler&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Define the devices list with the host, device_type, username, and password&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;devices = [&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "host": "",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "device_type": "extreme_exos",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "username": "",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "password": ""&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; },&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "host": "",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "device_type": "extreme_exos",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "username": "",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "password": ""&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Define the banner string to be displayed before login&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;banner = "WARNING: This device is part of the Network. Access to this device is restricted to authorized personnel only. Unauthorized access or use of this device may result in disciplinary action, civil liability, or criminal prosecution. All activity on this device is subject to monitoring and recording. By accessing this device, you consent to such monitoring and recording and agree to comply with the Alonso Network Acceptable Use Policy (AUP). If you do not agree, disconnect immediately."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Loop through each device in the devices list&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for device in devices:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; # Create a SSH connection to the device&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ssh_conn = ConnectHandler(**device)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; # Print the device hostname&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; print(f"Connected to {ssh_conn.find_prompt()}")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; # Send the configure banner before-login command with the banner string&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ssh_conn.send_config_set(f"&lt;/SPAN&gt;&lt;SPAN&gt;configure banner before-login\n{banner}\n")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; # Save the configuration&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ssh_conn.save_config()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; # Close the SSH connection&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ssh_conn.disconnect()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; # Print a confirmation message&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; print(f"Banner configured and saved on {device['host']}")&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2024 09:57:53 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-script-to-create-logon-banner/m-p/99426#M22327</guid>
      <dc:creator>robot71</dc:creator>
      <dc:date>2024-02-26T09:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: python script to create logon banner</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-script-to-create-logon-banner/m-p/99429#M22328</link>
      <description>&lt;P&gt;Your Python script for setting an EXOS switch login banner using netmiko looks generally correct. However, ensure that the "device_type" is specified as "extreme_exos," and after establishing an SSH connection, use the appropriate EXOS command (configure banner motd) to set the login banner. After sending the banner text, save the configuration with write memory for the changes to take effect. Test the script in a safe environment before applying it in production, adhering to your organization's procedures for network configuration changes.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 06:01:17 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-script-to-create-logon-banner/m-p/99429#M22328</guid>
      <dc:creator>katherine561</dc:creator>
      <dc:date>2024-02-27T06:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: python script to create logon banner</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-script-to-create-logon-banner/m-p/99430#M22329</link>
      <description>&lt;P&gt;&lt;SPAN&gt;configure banner before-login is the command for EXOS Though.&amp;nbsp;configure banner motd is for Cisco&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 06:29:48 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-script-to-create-logon-banner/m-p/99430#M22329</guid>
      <dc:creator>robot71</dc:creator>
      <dc:date>2024-02-27T06:29:48Z</dc:date>
    </item>
  </channel>
</rss>

