ā11-12-2020 03:20 PM
Hello,
I am trying to automat some processes for documentation with scripts. I am looking for a NBI query which gives back the model and Serial numbers of a Summit Stack. Can someone help me?
Kind regards
Christoph Schneider
Solved! Go to Solution.
ā11-13-2020 10:25 AM
Hello Christoph,
unfortunately there is no official guide for Python Scripting with XMC. But you can find many official examples under Task -> Scripts and Workflows not only the VLAN scripts.
More examples can also be found here: https://github.com/extremenetworks
For your concrete problem here a small example (quick and dirty) how to query a switch (XOS only!) and then output the serial numbers.
import re
#Send CLI commands
def sendConfigCmds(cmds):
for cmd in cmds:
cli_results = emc_cli.send( cmd )
if cli_results.isSuccess() is False:
print 'CLI-ERROR: ' + cli_results.getError()
return False
return cli_results.getOutput()
#Use allways a main function in XMC
def main():
commands = []
commands.append("show version")
result = sendConfigCmds( commands )
if result:
result_lines = result.splitlines()
for line in result_lines:
match = re.search("Slot.*?:",line)
if match:
line_parts = line.split()
if len(line_parts) > 2:
print("Serial: " + line_parts[3])
#Start program
main()
Here is what you will see with āshow versionā:
Slot-1 sw001 # show version
Slot-1 : 800601-00-18 8914N-46722 Rev 18 BootROM: 1.0.2.1 IMG: 22.7.1.2
Slot-2 : 800601-00-18 8912N-46755 Rev 18 BootROM: 1.0.2.1 IMG: 22.7.1.2
Here is the output:
Serial: 8914N-46722
Serial: 8912N-46755
Hope that helps.
ā11-13-2020 07:51 AM
Hello,
from the XMC point of view, a stack is just one device, no matter how many switches are attached to it. Therefore you won't find any information about stack members anywhere in the XMC (only if you create your own FlexViews and ask MIBs). Correspondingly also not in the NBI.
The only possibility, I see, is to ask the switches directly. You can simply create a script or a workflow that reads the information directly from the switches (stacks) via CLI.
If you need the data externally, you can send it by mail or store it on a file on a network share that is connected to the XMC.
Surely not as nice as query this externally with the NBI. But it works.
ā11-12-2020 04:02 PM
This is all youāll be able to get from NBI.
Mig
ā11-12-2020 03:49 PM
Thanks again. But still only information over the primary node.
ā11-12-2020 03:39 PM
Christoph,
I donāt have Summit stack to test it, check withthis if you find something:
{
network{devices {
id
chassisId
deviceData {
addEnableAuthOnAccess
addSyslogServer
addToGroup
addToNacGroup
addToNetsight
addToPolicyDomain
addToSiteArchive
addToSiteMap
addTrapServer
addZtpPlus
apCount
archiveId
assetTag
bootProm
chassisId
chassisMac
checkRmaConfiguration
companyName
connectedIpAddress
connector
createDeviceTime
currentlicenseKey
defaultSiteId
defaultSitePath
details
deviceASN
deviceDisplayType
deviceId
deviceSitePrecedence
disconnectPrecedence
dnsServer
dnsServer2
dnsServer3
dot1qMaxVlanId
enableCollection
enforceNeeded
ezConfigComplete
ezConfigCompleteError
ezConfigCompleteOrPending
ezConfigCompleteWithoutError
ezConfigConfigFailed
ezConfigConnect
ezConfigImageUpgrade
ezConfigPreReg
ezConfigReadyToSendConfig
ezConfigRma
ezConfigRmaFailed
ezConfigStaged
ezConfigState
ezconfig
fabricAttachEnable
fabricAttachRole
fabricDvrDomainId
fabricDvrRole
fabricEnable
fabricIpV4Shortcuts
fabricIpV6Shortcuts
fabricIsisIpSourceAddress
fabricIsisIpV6SourceAddress
fabricManualArea
fabricMulticastEnable
fabricName
fabricNickName
fabricPrimaryBVlan
fabricSecondaryBVlan
fabricSystemId
fabricSystemName
fabricTopologyType
fabricType
family
firmware
firstSeenTime
gateway
groupId
hasVendorProfileChanges
ipAddress
jsonVendorProfile
lacp
lacpLogging
lastEnforce
lastEnforceUser
lastLicenseUpdateTime
lastSeenTime
lastUpdate
lldp
lldpLogging
macAddress
mapId
mgmtInterface
mgmtInterfaceOutOfBand
mgmtInterfaceVlan
mvrp
mvrpLogging
nacApplianceGroup
nacJsonParameters
name
newController
nickname
nosId
note
ntpServer
ntpServer2
ospf
ospfLogging
outOfService
physicalPortCount
poe
poeLogging
policyDomain
pollGroup
pollType
prefix
preregistrationCreator
preregistrationTimestamp
productName
profileId
profileName
regionDomain
registerSyslogReceiver
registerTrapReceiver
replacementSerialNumber
rmaConfigured
serialNumber
siteId
snmpRetry
snmpTimeout
source
spanningTree
spanningTreeLogging
stacking
stackingLogging
statisticsCollectionLevel
status
subFamily
syncChangedSnmpField
syncDesiredFabricDvrLeafModeBoot
syncDesiredVlansToCurrent
sysContact
sysDescr
sysLocation
sysName
sysObjectId
sysObjectIdName
timesSeen
topologyRole
userData1
userData2
userData3
userData4
vendor
vxlan
vxlanLogging
wirelessController
ztpAllowComputeSite
ztpCLIRecoveryModeOnly
ztpConfigImport
ztpDnsSearchSuffix
ztpDomainName
ztpLastPollIntervalInMs
ztpPlusCachedConfigurationHashCode
ztpPlusCachedFullConfigurationHashCode
ztpPlusHttpEnabled
ztpPlusHttpsEnabled
ztpPlusLldpHoldTime
ztpPlusRequestConfig
ztpPlusSnmpEnabled
ztpPlusSshEnabled
ztpPlusTelnetEnabled
ztpScheduledConfigureDate
ztpScheduledConfigurePending
ztpScheduledConfigureTime
ztpScheduledConfigureType
ztpScheduledDownloadDate
ztpScheduledDownloadPending
ztpScheduledDownloadTime
ztpScheduledDownloadType
ztpUseDiscoveredMode
}
}}
}
Mig
ā11-12-2020 03:30 PM
Hello Mig,
thank you for your answer but this query only gives back the Information for the primary node of the stack.
Kind regards
Christoph Schneider