def IxVmCreateVmCardsAndPortsPy(ixNet): # This API will go discover all created IxVM Load Modules and bring them up # as cards/ports for usage. # This API will assume that each virtual load module has one eth1 interface created # as test port. # This API requires calling APIs: # - ixVmRediscoverAppliances() # - ixVmDiscoverAppliances() # Returns an XML format of discovered load module management IP addresses rediscoverStatus = ixVmRediscoverAppliancesPy(ixNet) discoveredAppliances = IxVmDiscoverAppliancesPy(ixNet) availableHardwareObj = ixNet.getList(ixNet.getRoot(), 'availableHardware')[0] vChassisObj = ixNet.getList(availableHardwareObj, 'virtualChassis')[0] cardNumber = 1 for eachAppliance in discoveredAppliances: mgmtIp =ixNet.getAttribute(eachAppliance, '-managementIp') print 'Adding new ixVmCard %d/%s: %s' % (cardNumber, '1', eachAppliance) # ::ixNet::OBJ-/availableHardware/virtualChassis/ixVmCard:L6 ixVmCardObj = ixNet.add(vChassisObj, 'ixVmCard') ixNet.setMultiAttribute(ixVmCardObj, '-managementIp', mgmtIp, '-cardId', str(cardNumber)) ixNet.commit() # ::ixNet::OBJ-/availableHardware/virtualChassis/ixVmCard:"Card1"/ixVmPort:L7 ixVmPortObj = ixNet.add(ixVmCardObj, 'ixVmPort') ixNet.setMultiAttribute(ixVmPortObj, '-portId', '1', '-interface', 'eth1', '-promiscuous', 'false', '-mtu', '1500') ixNet.commit() cardNumber += 1