05-02-2019 11:00 AM
# @DetailDescriptionStart
#############################################################################
# Modify Uplink VLAN Configuration on EXOS Switch - device-based
#
# Script : EXOS UPL VLAN Modification
# Revision : 1.0
# History #1 : make script running
# Last Updated : 02.05.2019
# Author : M.Nees (BELL)
#
#####################################################################
#
#######################################################################################
# @DetailDescriptionEnd
#######################################################################################
# @ScriptDescription "Device-based Uplink VLAN Configuration for EXOS Switches"
# @SectionStart (description = VLAN Informationen)
#
# @VariableFieldLabel (description = "Uplink Kennzeichner",
# type = String,
# scope = global,
#)
set var UPL_name UPLINK
# @VariableFieldLabel (description = "Neues VLAN (max. 1 VLAN) - VLAN-ID",
# type = String,
# scope = global,
#)
set var VLAN_ID ""
# @VariableFieldLabel (description = "VLAN Mode: Untagged (UT) oder Tagged (T)",
# type = String,
# validValues=[UT,T],
# scope = global,
#)
set var VLAN_mode "T"
# @MetaDataEnd
###########################################################
# Get the list of Uplink Ports
# Define Variable a fix start-point
set var UPL_port "x"
echo "****************************************************"
echo "*List device port information: "
CLI show ports description
echo "****************************************************"
regexp ".*${UPL_name}.*" ${CLI.OUT} isUPL_LABELexists
IF ([info exists isUPL_LABELexists]) THEN
puts "Some Ports are labeled as $UPL_name"
# Add new VLAN additionally to Uplink Port
CLI create vlan $VLAN_id
# Lets try to catch port number of uplink port
set content $CLI_OUT
set records [split $content "\n"]
foreach line $records {
IF ([regexp ".*${UPL_name}.*" $line match]) THEN
set UPL_port [lindex $line 0]
# Add new VLAN addiotionally to Uplink Port
IF ([string equal $VLAN_mode "UT"]) THEN
CLI conf vlan $VLAN_id add $UPL_port untagged
ELSE
CLI conf vlan $VLAN_id add $UPL_port tagged
ENDIF
ENDIF
}
ENDIF
EMC User: root
EMC User Domain:
CLI Login: cli-admin
TEST-SW 10.1.1.210 05/02/2019 12:26:47 PM at 12:26:47 PM
****************************************************
*List device port information:
TEST-SW.1 # show ports description
Port Display String Description String
===== ==================== ==================================================
1
2
3
4
5
6 UPLINK UPLINK
7
8
9
10
11
12
13
14
15
16
===== ==================== ==================================================
TEST-SW.2 #
****************************************************
Some Ports are labeled as UPLINK
javax.script.ScriptException:
*** Script Error ***
null
-> if { [info exists isUPL_LABELexists] } {
05-09-2019 07:00 AM
05-09-2019 06:51 AM