<?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 If (when) switch reboots, in Network Management</title>
    <link>https://community.cisco.com/t5/network-management/eem-tcl-script-for-changing-vlan-on-ports-on-link-down-reboot/m-p/2596672#M120045</link>
    <description>&lt;P&gt;If (when) switch reboots, check file and change vlan on all remaining interfaces.&lt;/P&gt;</description>
    <pubDate>Sat, 24 Jan 2015 07:30:07 GMT</pubDate>
    <dc:creator>Tommy Vindvik</dc:creator>
    <dc:date>2015-01-24T07:30:07Z</dc:date>
    <item>
      <title>EEM/Tcl script for changing vlan on ports on link down/reboot - read list of ports from a file?</title>
      <link>https://community.cisco.com/t5/network-management/eem-tcl-script-for-changing-vlan-on-ports-on-link-down-reboot/m-p/2596670#M120043</link>
      <description>&lt;P&gt;Hi everybody!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm working with a regional public health-care provider in Norway, and we have a total of&amp;nbsp;around ~42k access ports in our different campus networks. Access network consists of 3560/3750/3750-X/3850 and 4500 on different HW and SW&amp;nbsp;levels.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sometimes we se the need to change the vlan on a &lt;STRONG&gt;LOT &lt;/STRONG&gt;of ports to get the clients over in another network for one reason or another. To minimize impact for the DHCP-attached clients, I'm looking for some way of doing this on port down event and preferably also on reboot (not all wireing-closets have&amp;nbsp;UPS).&lt;/P&gt;
&lt;P&gt;I have not learned to "speak" Tcl yet, and I understand that the file handling in EEM applets is very basic even in EEM v4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I'm looking for a script that:&lt;/P&gt;
&lt;UL&gt;&lt;LI&gt;Reads interface ID and new&amp;nbsp;vlan ID from a file we can upload to flash&lt;/LI&gt;&lt;LI&gt;Changes the vlan id (switchport access vlan XX) to YY &lt;STRONG&gt;AND &lt;/STRONG&gt;possibly the voice vlan&amp;nbsp;on interface down event&lt;/LI&gt;&lt;LI&gt;Bonus points for running&amp;nbsp;trough any remaining interfaces on reload&lt;/LI&gt;&lt;LI&gt;Tracks the changes&amp;nbsp;to a logfile&lt;/LI&gt;&lt;LI&gt;One mail after all interfaces in list are completed&lt;/LI&gt;&lt;LI&gt;Triple bonus point for a scipt compatible with older EEM-versions (due to the different HW and SW&amp;nbsp;levels in network).&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The interface list input file could be constructed anyway needed, but maybe something like this:&lt;/P&gt;

&lt;PRE&gt;
Interface&amp;lt;tab&amp;gt;New vlan ID&amp;lt;tab&amp;gt;New Voice vlan   &amp;lt;- Not needed in actual file
FastEthernet1/0/43&amp;lt;tab&amp;gt;100
Gi2/0/38&amp;lt;tab&amp;gt;110
Gi1/43&amp;lt;tab&amp;gt;120&amp;lt;tab&amp;gt;300&lt;/PRE&gt;

&lt;P&gt;And the logfile could be something like:&lt;/P&gt;

&lt;PRE&gt;
Interface Fa1/0/43 changed on interface down from vlan id XX to YY dd.mm.yyyy hh:mm:ss
Interface Gi1/43 changed on reload from vlan id XX to YY AND voice vlan ZZ dd.mm.yyyy hh:mm:ss&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Soooo.....have anyone made/seen such a script, or something like it that could be adapted? Or do anyone Tcl-fluid people feel like helping me out? :) I can't quite imagine that we are the only one seeing the need for such a script?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Keeping the faith in the community :)&lt;/P&gt;
&lt;P&gt;Tommy V&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(Edit: Added voice vlan)&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jan 2015 12:23:23 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-management/eem-tcl-script-for-changing-vlan-on-ports-on-link-down-reboot/m-p/2596670#M120043</guid>
      <dc:creator>Tommy Vindvik</dc:creator>
      <dc:date>2015-01-23T12:23:23Z</dc:date>
    </item>
    <item>
      <title>Can you explain further on</title>
      <link>https://community.cisco.com/t5/network-management/eem-tcl-script-for-changing-vlan-on-ports-on-link-down-reboot/m-p/2596671#M120044</link>
      <description>&lt;P&gt;Can you explain further on this bullet point? &amp;nbsp; What does running through remaining interfaces mean?&lt;/P&gt;&lt;UL style="margin-top: 15px; margin-bottom: 0px; font-size: 14px;"&gt;&lt;LI style="margin: 5px 0px;"&gt;Bonus points for running&amp;nbsp;trough any remaining interfaces on reload&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Sat, 24 Jan 2015 00:26:16 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-management/eem-tcl-script-for-changing-vlan-on-ports-on-link-down-reboot/m-p/2596671#M120044</guid>
      <dc:creator>Dan Frey</dc:creator>
      <dc:date>2015-01-24T00:26:16Z</dc:date>
    </item>
    <item>
      <title>If (when) switch reboots,</title>
      <link>https://community.cisco.com/t5/network-management/eem-tcl-script-for-changing-vlan-on-ports-on-link-down-reboot/m-p/2596672#M120045</link>
      <description>&lt;P&gt;If (when) switch reboots, check file and change vlan on all remaining interfaces.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Jan 2015 07:30:07 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-management/eem-tcl-script-for-changing-vlan-on-ports-on-link-down-reboot/m-p/2596672#M120045</guid>
      <dc:creator>Tommy Vindvik</dc:creator>
      <dc:date>2015-01-24T07:30:07Z</dc:date>
    </item>
    <item>
      <title>OK thats what I thought but</title>
      <link>https://community.cisco.com/t5/network-management/eem-tcl-script-for-changing-vlan-on-ports-on-link-down-reboot/m-p/2596673#M120046</link>
      <description>&lt;P&gt;OK thats what I thought but wanted to make sure.&amp;nbsp;&amp;nbsp; Attached is a policy that meets all your bullet points except for the last one.&amp;nbsp; Not sure what hardware or EEM version would not support the attachment.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There needs to be a prepositioned file on flash that will be used to read in the "interface datavlan voicevlan".&amp;nbsp;&amp;nbsp; If a port transitions from up -&amp;gt; down that will trigger the policy or on reboot the policy will read in the entire file on flash and provision all the ports.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My prepositioned file on flash.&lt;/P&gt;&lt;P&gt;Switch_2#more flash:vlan&lt;BR /&gt;FastEthernet0/18 101 301&lt;BR /&gt;FastEthernet0/19 101&lt;BR /&gt;FastEthernet0/20 100&lt;BR /&gt;FastEthernet0/21 101&lt;BR /&gt;FastEthernet0/22 102&lt;BR /&gt;FastEthernet0/24 104&lt;/P&gt;&lt;P&gt;&amp;nbsp; Tested on&lt;/P&gt;&lt;P&gt;Cisco IOS Software, C3560 Software (C3560-IPSERVICESK9-M), Version 12.2(55)SE1, RELEASE SOFTWARE (fc1)&lt;/P&gt;&lt;P&gt;Log messages to console and also written to a log file on flash on reboot.&lt;/P&gt;&lt;P&gt;00:01:02: %HA_EM-6-LOG: vlanmap.tcl: Interface FastEthernet0/18 changed on reload from vlan id 1 to 101 and voicevlan none changed to 301 00:01:01.723 UTC Mon Mar 1 1993&lt;BR /&gt;00:01:03: %HA_EM-6-LOG: vlanmap.tcl: Interface FastEthernet0/19 changed on reload from vlan id 1 to 101 00:01:01.723 UTC Mon Mar 1 1993&lt;BR /&gt;00:01:04: %HA_EM-6-LOG: vlanmap.tcl: Interface FastEthernet0/20 changed on reload from vlan id 1 to 100 00:01:01.723 UTC Mon Mar 1 1993&lt;BR /&gt;00:01:04: %HA_EM-6-LOG: vlanmap.tcl: Interface FastEthernet0/21 changed on reload from vlan id 1 to 101 00:01:01.723 UTC Mon Mar 1 1993&lt;BR /&gt;00:01:05: %HA_EM-6-LOG: vlanmap.tcl: Interface FastEthernet0/22 changed on reload from vlan id 1 to 102 00:01:01.723 UTC Mon Mar 1 1993&lt;BR /&gt;00:01:06: %HA_EM-6-LOG: vlanmap.tcl: Interface FastEthernet0/24 changed on reload from vlan id 1 to 104 00:01:01.723 UTC Mon Mar 1 1993&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Jan 2015 17:53:06 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-management/eem-tcl-script-for-changing-vlan-on-ports-on-link-down-reboot/m-p/2596673#M120046</guid>
      <dc:creator>Dan Frey</dc:creator>
      <dc:date>2015-01-24T17:53:06Z</dc:date>
    </item>
    <item>
      <title>Daniel, I'm impressed! :)</title>
      <link>https://community.cisco.com/t5/network-management/eem-tcl-script-for-changing-vlan-on-ports-on-link-down-reboot/m-p/2596674#M120047</link>
      <description>&lt;P&gt;Daniel,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm impressed! :) That was a swift response :)&lt;/P&gt;&lt;P&gt;I will test this in my lab and on&amp;nbsp;a few switches in my network :)&lt;/P&gt;&lt;P&gt;A few questions after just browsing the code however, just trying to understand Tlc better:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Any reason you use the syslog event instead of the&amp;nbsp;::cisco::eem::event_register_interface&amp;nbsp;to match/find interfaces transitioning to down? Personal preference, or some other reason?&lt;/LI&gt;&lt;LI&gt;Any way to make the script more "self contained"? Seems like I have to set a few environment variables "outside" the script? Could these be set inside the script instead?&lt;/LI&gt;&lt;LI&gt;Again, not fluid in Tlc, but it might seem like it sends mail for each interface changed? Or am I misreading the code?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Tommy V&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jan 2015 11:30:03 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-management/eem-tcl-script-for-changing-vlan-on-ports-on-link-down-reboot/m-p/2596674#M120047</guid>
      <dc:creator>Tommy Vindvik</dc:creator>
      <dc:date>2015-01-26T11:30:03Z</dc:date>
    </item>
    <item>
      <title>Its my personal preference to</title>
      <link>https://community.cisco.com/t5/network-management/eem-tcl-script-for-changing-vlan-on-ports-on-link-down-reboot/m-p/2596675#M120048</link>
      <description>&lt;P&gt;Its my personal preference to use the syslog ED.&amp;nbsp; I use the syslog detector often and have the regexp built for it as well so it was just a copy/paste for this EEM policy.&amp;nbsp; If all of the environment variables remain static across your network then there is no reason to do this in the CLI and the variables can be addressed in the tcl file.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Add these variables&lt;/STRONG&gt;&amp;nbsp; in the tcl file after:&lt;/P&gt;&lt;P&gt;namespace import ::cisco::eem::*&lt;/P&gt;&lt;P&gt;namespace import ::cisco::lib::*&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;set write_filename "your file name"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;set read_filename "your file name"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ect... set rest of the variables here ....&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;When syslog detects a single interface going up -&amp;gt; down it will generate an email, syslog, update the logfile.&amp;nbsp; If you have multiple interfaces going down at once you will get an email, syslog, update logfile per interface.&amp;nbsp;&amp;nbsp; When the device is reloaded it will aggregate all the actions into a single email, generate multiple syslogs, and update the logfile.&lt;/P&gt;&lt;P&gt;Dan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jan 2015 14:20:47 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-management/eem-tcl-script-for-changing-vlan-on-ports-on-link-down-reboot/m-p/2596675#M120048</guid>
      <dc:creator>Dan Frey</dc:creator>
      <dc:date>2015-01-26T14:20:47Z</dc:date>
    </item>
    <item>
      <title>Good to know I was reading</title>
      <link>https://community.cisco.com/t5/network-management/eem-tcl-script-for-changing-vlan-on-ports-on-link-down-reboot/m-p/2596676#M120049</link>
      <description>&lt;P&gt;Good to know I was reading the code correctly, even with close to none Tcl-experience :)&lt;/P&gt;&lt;P&gt;And I can see the use for mailing on every interface changed, but my goal was to log/syslog&amp;nbsp;these and send a mail only when all interfaces in file was changed/completed.&lt;/P&gt;&lt;P&gt;I don't&amp;nbsp;want several hundred mails during such a change.process, if anything goes wrong I could log onto the switch and check the logfile (or check the syslog) - but I do want to know when everything is completed :)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Tommy V&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jan 2015 14:36:31 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-management/eem-tcl-script-for-changing-vlan-on-ports-on-link-down-reboot/m-p/2596676#M120049</guid>
      <dc:creator>Tommy Vindvik</dc:creator>
      <dc:date>2015-01-26T14:36:31Z</dc:date>
    </item>
    <item>
      <title>Hi All,</title>
      <link>https://community.cisco.com/t5/network-management/eem-tcl-script-for-changing-vlan-on-ports-on-link-down-reboot/m-p/2596677#M120050</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi All,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I am new to TCL scripting and seeking your help for below requirement&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I have to change vlans in training rooms twice in a day (Morning &amp;amp; in evening at particular time frame) and this is hitting me badly as sometime I get late and getting unnecessary escalations. Can someone suggest me if TCL script/Kron can be used and vlans can be changed automatically at particular time frame. If a script can be loaded in tftp and there I can change vlan IDs in any time and when training time start just it triggers and all vlans should be changed!!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Is it possible? I think by EEM its possible but EEM is not supported.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 13:42:43 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-management/eem-tcl-script-for-changing-vlan-on-ports-on-link-down-reboot/m-p/2596677#M120050</guid>
      <dc:creator>bhisham Sharma</dc:creator>
      <dc:date>2015-11-18T13:42:43Z</dc:date>
    </item>
    <item>
      <title>Please start a new thread for</title>
      <link>https://community.cisco.com/t5/network-management/eem-tcl-script-for-changing-vlan-on-ports-on-link-down-reboot/m-p/2596678#M120051</link>
      <description>&lt;P&gt;Please start a new thread for your question.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 16:42:33 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-management/eem-tcl-script-for-changing-vlan-on-ports-on-link-down-reboot/m-p/2596678#M120051</guid>
      <dc:creator>Dan Frey</dc:creator>
      <dc:date>2015-11-18T16:42:33Z</dc:date>
    </item>
    <item>
      <title>I have already started a new</title>
      <link>https://community.cisco.com/t5/network-management/eem-tcl-script-for-changing-vlan-on-ports-on-link-down-reboot/m-p/2596679#M120052</link>
      <description>&lt;P&gt;I have already started a new thread!!&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2015 07:26:10 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-management/eem-tcl-script-for-changing-vlan-on-ports-on-link-down-reboot/m-p/2596679#M120052</guid>
      <dc:creator>bhisham Sharma</dc:creator>
      <dc:date>2015-11-19T07:26:10Z</dc:date>
    </item>
  </channel>
</rss>

