def IxVmDiscoverAppliancesPy(ixNet): availableHardwareObj = ixNet.getList(ixNet.getRoot(), 'availableHardware')[0] vChassisObj = ixNet.getList(availableHardwareObj, 'virtualChassis')[0] # Load Modules # ['::ixNet::OBJ-/availableHardware/virtualChassis/discoveredAppliance:"192.168.70.130"', # '::ixNet::OBJ-/availableHardware/virtualChassis/discoveredAppliance:"192.168.70.131"'] discoveredApplianceList = ixNet.getList(vChassisObj, 'discoveredAppliance') for eachDiscoveredAppliance in discoveredApplianceList: print 'DiscoveredAppliances:', eachDiscoveredAppliance return discoveredApplianceList et true/false for the portIndex number. root = ixNet.getRoot() ixNetGlobals = root+'globals' globalTopology = ixNetGlobals+'/topology' globalTopologyIp = globalTopology+'/'+ipType if ipType is 'ipv4': supressKey = '-suppressArpForDuplicateGateway' else: supressKey = '-suppressNsForDuplicateGateway' portNameList = ixNet.getAttribute(globalTopologyIp, '-rowNames') for portName in portNameList: multiValue = ixNet.getAttribute(globalTopologyIp, supressKey) try: portIndex = portNameList.index(portName)+1 except: print '\nDisableSupressArpAllPorts Error: No such port configured:', portName return 1 else: overlayDiscoveredFlag = 0 overlayList = ixNet.getList(multiValue, 'overlay') if overlayList: for overlay in overlayList: currentIndex = ixNet.getAttribute(overlay, '-index') if portIndex == currentIndex: overlayDiscoveredFlag = 1 print '\nEnableDisableSuppressArpAllPorts = %s' % action ixNetResult = ixNet.setMultiAttribute(overlay, '-value', action, '-valueStep', action, '-count', '1', '-indexStep', '0' ) if ixNetResult != '::ixNet::OK': print '\EnableDisableSuppressArpAllPorts error:', ixNetResult ixNet.commit() if overlayDiscoveredFlag == 0: # Getting here means no overlay index found for the $portIndex. # Have to create an overlay with the proper -index number. print '\nEnableDisableSuppressArpAllPorts: No overlay found for:', portName print 'Creating an overlay ...' currentOverlay = ixNet.add(multiValue, 'overlay') ixNet.setMultiAttribute(currentOverlay, '-value', action, '-valueStep', action, '-count', '1', '-index', portIndex ) ixNet.commit() else: # Getting here means there is no overlays. # Change the multiValue pattern to counter so that we # are able to modify anything ixNet.setAttribute(multiValue, '-pattern', 'counter') ixNet.commit() ixNet.setAttribute(multiValue+'/counter', '-start', 'true') ixNet.commit() print '\nEnableDisableSuppressArpAllPorts: Creating overlay: %s -index %s -value %s' % ( portName, portIndex, action) # Create Overlays with proper index number based on the portIndex # in $root/globals/topology/ipv4 -rowNames indexes currentOverlay = ixNet.add(multiValue, 'overlay') ixNet.setMultiAttribute(currentOverlay, '-value', action, '-valueStep', action, '-count', '1', '-index', portIndex ) ixNet.commit() return 0