Ok Stephane, I had a little play with this.
I just did a basic script to walks the keys in emc_vars dictionary and copied in some lines from a real script with custom variables defined. Seems a little weird to have a TCL style "set var" command at the top of some python but "whatever!".
I am still thinking about using the server scripts to load switch scripts and execute them but I guess for now I will see where I get with pure server scripts.
Regardless, you have cured me of TCLishness - pure python for me from here on.
Thanks for your help.
Ed.
#@MetaDataStart
#@DetailDescriptionStart
#############################################################################
# Extreme Networks(R) CLI Scripting Library
#
# Script : Trap Suppression
# Revision : 1.0
# Last Updated : October 16 2017
#
# Used to disable certain trap OIDs in a mib-view in order to suppress specific traps
# usually because they are endemic or we just don't care about them or don't want to
# overload the Alarm systems.
#
# Current relevant traps are:
# 1.3.6.1.4.1.1916.0.6 extremeOverheat
# 1.3.6.1.4.1.1916.0.7 extremeFanFailed
# 1.3.6.1.4.1.1916.0.8 extremeFanOK
# 1.3.6.1.4.1.1916.1.4.13.2.0.1 extremePortMauChangeTrap
#
#####################################################################
#@DetailDescriptionEnd
#############################################################################################
# Define identity management configuration parameters in this section.
#############################################################################################
#@SectionStart (description = Script configuration properties)
#@VariableFieldLabel ( description = "Trap OID List",
# type = String,
# scope = global,
# required = yes,
# readonly = no
#)
set var trapOidList 1.3.6.1.4.1.1916.0.7:exclude,1.3.6.1.4.1.1916.0.8:exclude
#@VariableFieldLabel (description = "Target MIB View"
# type = String,
# scope = global
# )
set var targetMibView AccessSwitchTraps
#@SectionEnd
#@MetaDataEnd
import os
print('Hello world! ' + os.getcwd())
for key, value in emc_vars.items() :
print (key, value)
print("trapOidList is " + emc_vars["trapOidList"])
print("targetMibView is " + emc_vars["targetMibView"])=====================================================================
Script output was as follows:
Date and Time: 2017-11-06T10:31:43.730
EMC User: 1101286
EMC User Domain:
IP: 10.130.254.20
Hello world! /usr/local/Extreme_Networks/NetSight/wildfly/bin
(u'date', u'2017-11-06')
(u'log4j.configuration', u'file:./log4j.properties')
(u'serverVersion', u'8.0.3')
(u'isExos', u'true')
(u'devicePwd', u'blindmickeymcgrew')
(u'USE_NETSNMP', u'true')
(u'enterasys.tomcat.http.port', u'8080')
(u'enterasys.tomcat.https.port', u'8443')
(u'javax.script.name', u'Python')
(u'managementPorts', u'')
(u'deviceName', u'Highland ES IDF1.20')
(u'deviceId', 297)
(u'javax.script.engine_version', u'2.7.0')
(u'deviceVR', u'VR-Default')
(u'javax.script.language', u'python')
(u'STATUS', 1)
(u'serverIP', u'10.254.231.12')
(u'scriptOwner', u'')
(u'auditLogEnabled', u'')
(u'deviceType', u'EXOS Stack-V80')
(u'interSwitchPorts', u'1:25,1:32,1:38,1:45,4:6,3:16,3:19,3:22,3:26,2:2,3:27,2:5,3:34,2:25,2:32')
(u'WmInfoHistory.ProcessEndSystemEvents', u'true')
(u'enterasys.mysqlrealm.rpt.password', u'enterasys')
(u'enterasys.tomcat.ciphers', u'TLS_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-GCM-SHA384,ECDHE-ECDSA-AES128-GCM-SHA256,ECDHE-RSA-AES128-GCM-SHA256,ECDHE-ECDSA-AES256-SHA384,ECDHE-RSA-AES256-SHA384,ECDHE-ECDSA-AES128-SHA256,ECDHE-RSA-AES128-SHA256')
(u'targetMibView', u'AccessSwitchTraps')
(u'accessPorts', u'1:24,2:48,1:26,1:27,1:28,1:29,1:30,1:31,1:33,1:34,1:35,1:36,1:37,1:39,1:40,1:41,1:42,1:43,1:44,1:46,1:47,1:48,4:1,4:2,4:3,4:4,4:5,4:7,4:8,4:9,4:10,4:11,4:12,4:13,4:14,4:15,4:16,4:17,4:18,4:19,4:20,4:21,4:22,4:23,4:24,3:1,4:25,3:2,4:26,3:3,4:27,3:4,4:28,3:5,4:29,3:6,4:30,3:7,4:31,3:8,4:32,3:9,4:33,3:10,4:34,3:11,4:35,3:12,4:36,3:13,4:37,3:14,4:38,3:15,4:39,4:40,3:17,4:41,3:18,4:42,4:43,3:20,4:44,3:21,4:45,4:46,3:23,4:47,3:24,4:48,3:25,2:1,2:3,3:28,2:4,3:29,3:30,2:6,3:31,2:7,3:32,2:8,3:33,2:9,2:10,3:35,2:11,3:36,2:12,3:37,2:13,3:38,2:14,3:39,2:15,3:40,2:16,3:41,2:17,3:42,2:18,3:43,2:19,3:44,2:20,3:45,2:21,3:46,2:22,3:47,2:23,3:48,2:24,1:1,1:2,2:26,1:3,2:27,1:4,2:28,1:5,2:29,1:6,2:30,1:7,2:31,1:8,1:9,2:33,1:10,2:34,1:11,2:35,1:12,2:36,1:13,2:37,1:14,2:38,1:15,2:39,1:16,2:40,1:17,2:41,1:18,2:42,1:19,2:43,1:20,2:44,1:21,2:45,1:22,2:46,1:23,2:47')
(u'enterasys.jboss.log4j.logfile', u'../../appdata/logs/server.log')
(u'domain', u'')
(u'enterasys.embeddednac.enable', u'false')
(u'nmsMobile.demoMode', u'false')
(u'enterasys.mysqlrealm.password', u'enterasys')
(u'endsystem.detail.mapping', u'moref=custom1,uuid=custom1')
(u'enterasys.webservices.queryendsystems', u'true')
(u'trapOidList', u'1.3.6.1.4.1.1916.0.7:exclude,1.3.6.1.4.1.1916.0.8:exclude')
(u'enterasys.mysqlrealm.rpt.username', u'netsight')
(u'enterasys.mysqlrealm.username', u'netsight')
(u'deviceASN', u'4269997588')
(u'deviceSysOid', u'1.3.6.1.4.1.1916.2.93')
(u'enterasys.datasource.connectionurl', u'jdbc:mysql://127.0.0.1:4589/netsight?jdbcCompliantTruncation=false&useUnicode=true&characterEncoding=UTF-8&useSSL=false')
(u'java.security.manager', u'')
(u'deviceLogin', u'netsight')
(u'serverName', u'10.254.18.218')
(u'deviceSoftwareVer', u'15.6.3.1')
(u'ports', u'1:24,2:48,1:25,1:26,1:27,1:28,1:29,1:30,1:31,1:32,1:33,1:34,1:35,1:36,1:37,1:38,1:39,1:40,1:41,1:42,1:43,1:44,1:45,1:46,1:47,1:48,4:1,4:2,4:3,4:4,4:5,4:6,4:7,4:8,4:9,4:10,4:11,4:12,4:13,4:14,4:15,4:16,4:17,4:18,4:19,4:20,4:21,4:22,4:23,4:24,3:1,4:25,3:2,4:26,3:3,4:27,3:4,4:28,3:5,4:29,3:6,4:30,3:7,4:31,3:8,4:32,3:9,4:33,3:10,4:34,3:11,4:35,3:12,4:36,3:13,4:37,3:14,4:38,3:15,4:39,3:16,4:40,3:17,4:41,3:18,4:42,3:19,4:43,3:20,4:44,3:21,4:45,3:22,4:46,3:23,4:47,3:24,4:48,3:25,2:1,3:26,2:2,3:27,2:3,3:28,2:4,3:29,2:5,3:30,2:6,3:31,2:7,3:32,2:8,3:33,2:9,3:34,2:10,3:35,2:11,3:36,2:12,3:37,2:13,3:38,2:14,3:39,2:15,3:40,2:16,3:41,2:17,3:42,2:18,3:43,2:19,3:44,2:20,3:45,2:21,3:46,2:22,3:47,2:23,3:48,2:24,1:1,2:25,1:2,2:26,1:3,2:27,1:4,2:28,1:5,2:29,1:6,2:30,1:7,2:31,1:8,2:32,1:9,2:33,1:10,2:34,1:11,2:35,1:12,2:36,1:13,2:37,1:14,2:38,1:15,2:39,1:16,2:40,1:17,2:41,1:18,2:42,1:19,2:43,1:20,2:44,1:21,2:45,1:22,2:46,1:23,2:47')
(u'java.security.policy', u'../server/default/conf/server.policy')
(u'oneView.responsetime.app.redline', u'1000')
(u'oneView.responsetime.tcp.redline', u'1000')
(u'vendor', u'Extreme')
(u'USE_IPV6', u'true')
(u'enterasys.datasource.rpt.connectionurl', u'jdbc:mysql://127.0.0.1:4589/netsightrpt?jdbcCompliantTruncation=false&useUnicode=true&characterEncoding=UTF-8&useSSL=false')
(u'javax.script.filename', u'/usr/local/Extreme_Networks/NetSight/appdata/scripting/overrides/hworld.py')
(u'dashboard.cache.time', u'2')
(u'javax.script.engine', u'python')
(u'deviceIP', u'10.130.254.20')
(u'jboss.bind.address', u'10.254.231.12')
(u'userDomain', u'')
(u'OneView.DisplayNacConfigurationTab', u'true')
(u'userName', u'1101286')
(u'scriptTimeout', u'60')
(u'time', u'10:31:43 EST')
(u'family', u'Summit Series')
(u'username', u'root')
trapOidList is 1.3.6.1.4.1.1916.0.7:exclude,1.3.6.1.4.1.1916.0.8:exclude
targetMibView is AccessSwitchTraps