<?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 RE: XMC Scripting  Port based Script how to insert user input in ExtremeCloud IQ- Site Engine Management Center</title>
    <link>https://community.extremenetworks.com/t5/extremecloud-iq-site-engine/xmc-scripting-port-based-script-how-to-insert-user-input/m-p/49873#M7188</link>
    <description>Hello Matthias,&lt;BR /&gt;
&lt;BR /&gt;
I am not sure what's going wrong. But here a working script with Python:&lt;BR /&gt;
&lt;BR /&gt;
import string&lt;BR /&gt;
&lt;BR /&gt;
myport = emc_vars["port"]&lt;BR /&gt;
&lt;BR /&gt;
fromcli = emc_cli.send("show port " + myport + " des").getOutput()&lt;BR /&gt;
print fromcli&lt;BR /&gt;
fromcli  = emc_cli.send("conf port " + myport + " des MyName")&lt;BR /&gt;
fromcli  = emc_cli.send("conf port " + myport + " dis MyName")&lt;BR /&gt;
fromcli  = emc_cli.send("show port " + myport + " des").getOutput()&lt;BR /&gt;
print check&lt;BR /&gt;
&lt;BR /&gt;
Regards&lt;BR /&gt;
Stephan&lt;BR /&gt;
&lt;BR /&gt;</description>
    <pubDate>Sun, 11 Nov 2018 00:22:00 GMT</pubDate>
    <dc:creator>StephanH</dc:creator>
    <dc:date>2018-11-11T00:22:00Z</dc:date>
    <item>
      <title>XMC Scripting  Port based Script how to insert user input</title>
      <link>https://community.extremenetworks.com/t5/extremecloud-iq-site-engine/xmc-scripting-port-based-script-how-to-insert-user-input/m-p/49872#M7187</link>
      <description>i want to use a port based XMC (TCL) Script in Device View for setting Port Alias on an EXOS Switch&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="fancybox-image"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="771304116ab94775ac9b5cd15f487970_RackMultipart20181110-122925-fh8rzi-XMC-Device-View_inline.png"&gt;&lt;img src="https://community.extremenetworks.com/t5/image/serverpage/image-id/2988iCE9CD83ACAD0BC2F/image-size/large?v=v2&amp;amp;px=999" role="button" title="771304116ab94775ac9b5cd15f487970_RackMultipart20181110-122925-fh8rzi-XMC-Device-View_inline.png" alt="771304116ab94775ac9b5cd15f487970_RackMultipart20181110-122925-fh8rzi-XMC-Device-View_inline.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
i know there is another point within XMC to set port aliases but first i need this here (fewer windows changes in daily business) and second i wants to know how to insert user input in such kind of port specific XMC scripts.&lt;BR /&gt;
&lt;BR /&gt;
i use this TCL script:&lt;BR /&gt;
#@MetaDataStart&lt;BR /&gt;
#@DetailDescriptionStart&lt;BR /&gt;
##############################################################################&lt;BR /&gt;
# Purpose       : Example script to set port-alias on EXOS Ports&lt;BR /&gt;
##############################################################################&lt;BR /&gt;
#@DetailDescriptionEnd&lt;BR /&gt;
&lt;BR /&gt;
#@MetaDataEnd&lt;BR /&gt;
###############################################################################&lt;BR /&gt;
&lt;BR /&gt;
#&lt;B&gt;@SectionStart&lt;/B&gt; (description = PortAlias )&lt;BR /&gt;
#&lt;B&gt;@VariableFieldLabel&lt;/B&gt; ( description = "PortAlias",type = String, scope = global,)&lt;BR /&gt;
set var PortAlias ""&lt;BR /&gt;
&lt;BR /&gt;
CLI conf $Port dis $PortAlias &lt;BR /&gt;
CLI conf $Port desc $PortAlias &lt;BR /&gt;
sleep 2 &lt;BR /&gt;
CLI show port $Port desc&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="fancybox-image"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="771304116ab94775ac9b5cd15f487970_RackMultipart20181110-60988-jzao8p-Script0_inline.png"&gt;&lt;img src="https://community.extremenetworks.com/t5/image/serverpage/image-id/4896iB257E314B63A4FF5/image-size/large?v=v2&amp;amp;px=999" role="button" title="771304116ab94775ac9b5cd15f487970_RackMultipart20181110-60988-jzao8p-Script0_inline.png" alt="771304116ab94775ac9b5cd15f487970_RackMultipart20181110-60988-jzao8p-Script0_inline.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;BR /&gt;
﻿But unfortunately the script does not request the input for variable $PortAlias.&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="fancybox-image"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="771304116ab94775ac9b5cd15f487970_RackMultipart20181110-38360-geh7aa-Script1_inline.png"&gt;&lt;img src="https://community.extremenetworks.com/t5/image/serverpage/image-id/1764i665CE51048E84AEF/image-size/large?v=v2&amp;amp;px=999" role="button" title="771304116ab94775ac9b5cd15f487970_RackMultipart20181110-38360-geh7aa-Script1_inline.png" alt="771304116ab94775ac9b5cd15f487970_RackMultipart20181110-38360-geh7aa-Script1_inline.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
it runs into an error because variable $PortAlias is empty.&lt;BR /&gt;
&lt;BR /&gt;
&lt;P class="fancybox-image"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="771304116ab94775ac9b5cd15f487970_RackMultipart20181110-97241-6hbf66-Script2_inline.png"&gt;&lt;img src="https://community.extremenetworks.com/t5/image/serverpage/image-id/642i7F4238800AD7EAE5/image-size/large?v=v2&amp;amp;px=999" role="button" title="771304116ab94775ac9b5cd15f487970_RackMultipart20181110-97241-6hbf66-Script2_inline.png" alt="771304116ab94775ac9b5cd15f487970_RackMultipart20181110-97241-6hbf66-Script2_inline.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
How can i trigger that the input was retrieved and can be set via CLI successfully ??&lt;BR /&gt;
&lt;BR /&gt;</description>
      <pubDate>Sat, 10 Nov 2018 23:03:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremecloud-iq-site-engine/xmc-scripting-port-based-script-how-to-insert-user-input/m-p/49872#M7187</guid>
      <dc:creator>M_Nees</dc:creator>
      <dc:date>2018-11-10T23:03:00Z</dc:date>
    </item>
    <item>
      <title>RE: XMC Scripting  Port based Script how to insert user input</title>
      <link>https://community.extremenetworks.com/t5/extremecloud-iq-site-engine/xmc-scripting-port-based-script-how-to-insert-user-input/m-p/49873#M7188</link>
      <description>Hello Matthias,&lt;BR /&gt;
&lt;BR /&gt;
I am not sure what's going wrong. But here a working script with Python:&lt;BR /&gt;
&lt;BR /&gt;
import string&lt;BR /&gt;
&lt;BR /&gt;
myport = emc_vars["port"]&lt;BR /&gt;
&lt;BR /&gt;
fromcli = emc_cli.send("show port " + myport + " des").getOutput()&lt;BR /&gt;
print fromcli&lt;BR /&gt;
fromcli  = emc_cli.send("conf port " + myport + " des MyName")&lt;BR /&gt;
fromcli  = emc_cli.send("conf port " + myport + " dis MyName")&lt;BR /&gt;
fromcli  = emc_cli.send("show port " + myport + " des").getOutput()&lt;BR /&gt;
print check&lt;BR /&gt;
&lt;BR /&gt;
Regards&lt;BR /&gt;
Stephan&lt;BR /&gt;
&lt;BR /&gt;</description>
      <pubDate>Sun, 11 Nov 2018 00:22:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremecloud-iq-site-engine/xmc-scripting-port-based-script-how-to-insert-user-input/m-p/49873#M7188</guid>
      <dc:creator>StephanH</dc:creator>
      <dc:date>2018-11-11T00:22:00Z</dc:date>
    </item>
    <item>
      <title>RE: XMC Scripting  Port based Script how to insert user input</title>
      <link>https://community.extremenetworks.com/t5/extremecloud-iq-site-engine/xmc-scripting-port-based-script-how-to-insert-user-input/m-p/49874#M7189</link>
      <description>Hallo Matthias,&lt;BR /&gt;
&lt;BR /&gt;
if you want a input box to define the port description add the following info to the "Meta" section:&lt;BR /&gt;
&lt;BR /&gt;
#&lt;B&gt;@SectionStart&lt;/B&gt; (description = Specify port description)&lt;BR /&gt;
# &lt;BR /&gt;
#&lt;B&gt;@VariableFieldLabel&lt;/B&gt; (description = "Enter port description", &lt;BR /&gt;
# type = String, &lt;BR /&gt;
# required = yes, &lt;BR /&gt;
# readOnly = no &lt;BR /&gt;
# ) &lt;BR /&gt;
set var portname MyPort&lt;BR /&gt;
#&lt;B&gt;@SectionEnd&lt;/B&gt; &lt;BR /&gt;
#&lt;B&gt;@MetaDataEnd&lt;/B&gt; &lt;BR /&gt;
&lt;BR /&gt;
portname = emc_vars["portname"]  With the last line the info from the input field is assigned to the variable portname.&lt;BR /&gt;
&lt;BR /&gt;
Regards&lt;BR /&gt;
Stephan&lt;BR /&gt;
&lt;BR /&gt;</description>
      <pubDate>Sun, 11 Nov 2018 00:41:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremecloud-iq-site-engine/xmc-scripting-port-based-script-how-to-insert-user-input/m-p/49874#M7189</guid>
      <dc:creator>StephanH</dc:creator>
      <dc:date>2018-11-11T00:41:00Z</dc:date>
    </item>
    <item>
      <title>RE: XMC Scripting  Port based Script how to insert user input</title>
      <link>https://community.extremenetworks.com/t5/extremecloud-iq-site-engine/xmc-scripting-port-based-script-how-to-insert-user-input/m-p/49875#M7190</link>
      <description>With the help of Stephan i can get the script file running.&lt;BR /&gt;
&lt;BR /&gt;
I do some mistakes in the header sections - it is important to look at the start and the end of the sections. Input fields have to be within the MetaData Section ...&lt;BR /&gt;
Another problem is that i use $port Variable as $Port which is not the same = case sensitive&lt;BR /&gt;
&lt;BR /&gt;
Here my simple script:&lt;BR /&gt;
&lt;BR /&gt;
#@MetaDataStart&lt;BR /&gt;
#@DetailDescriptionStart&lt;BR /&gt;
##############################################################################&lt;BR /&gt;
# Purpose       : Example script to set port-alias on EXOS Ports&lt;BR /&gt;
##############################################################################&lt;BR /&gt;
#@DetailDescriptionEnd&lt;BR /&gt;
&lt;BR /&gt;
#&lt;B&gt;@SectionStart&lt;/B&gt; (description = Specify port decription)&lt;BR /&gt;
# &lt;BR /&gt;
#&lt;B&gt;@VariableFieldLabel&lt;/B&gt; (description = "Enter port decription", &lt;BR /&gt;
# type = String, &lt;BR /&gt;
# required = yes, &lt;BR /&gt;
# readOnly = no &lt;BR /&gt;
# ) &lt;BR /&gt;
set var PortAlias MyPortAlias&lt;BR /&gt;
#&lt;B&gt;@SectionEnd&lt;/B&gt; &lt;BR /&gt;
#&lt;B&gt;@MetaDataEnd&lt;/B&gt; &lt;BR /&gt;
&lt;BR /&gt;
CLI conf port $port dis $PortAlias &lt;BR /&gt;
CLI conf port $port desc $PortAlias &lt;BR /&gt;
sleep 1 &lt;BR /&gt;
CLI show port $port desc&lt;BR /&gt;
sleep 1&lt;BR /&gt;
CLI save config&lt;BR /&gt;</description>
      <pubDate>Mon, 12 Nov 2018 01:44:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremecloud-iq-site-engine/xmc-scripting-port-based-script-how-to-insert-user-input/m-p/49875#M7190</guid>
      <dc:creator>M_Nees</dc:creator>
      <dc:date>2018-11-12T01:44:00Z</dc:date>
    </item>
  </channel>
</rss>

