def IxVmRemoveCardIdPy(ixNet, vmCardId): # This API will remove the specified vm card ID. # ixNet = object # Example: ixNet = IxNetwork.IxNet() & ixNet.connect(apiServer) import re availableHardware = ixNet.getList(ixNet.getRoot(), 'availableHardware')[0] vChassisObj = ixNet.getList(availableHardware, 'virtualChassis')[0] vmCardList = ixNet.getList(vChassisObj, 'ixVmCard') releaseAllPortsPy(ixNet) for eachVmCardId in vmCardList: # '::ixNet::OBJ-/availableHardware/virtualChassis/ixVmCard:"Card1"' currentCardIdMatch = re.match('::ixNet.*ixVmCard.*Card([0-9]+)', eachVmCardId) if currentCardIdMatch: if int(currentCardIdMatch.group(1)) == vmCardId: print '\nremoveCardId:', eachVmCardId ixNet.remove(eachVmCardId) ixNet.commit() return 0 return 1