def ModifyBgpNumberOfRoutesNgpf( networkGroupName='', totalRoutes='' ): for topology in ixNet.getList(ixNet.getRoot(), 'topology'): for deviceGroup in ixNet.getList(topology, 'deviceGroup'): for networkGroup in ixNet.getList(deviceGroup, 'networkGroup'): currentNetworkGroupName = ixNet.getAttribute(networkGroup, '-name') nameMatch = re.search(r'%s' % networkGroupName, currentNetworkGroupName, re.IGNORECASE) if nameMatch: for ipv4PrefixPool in ixNet.getList(networkGroup, 'ipv4PrefixPools'): print '\nModifyBgpNumberOfRoutesNgpf: %s : totalRoutes:%s' % (ipv4PrefixPool, totalRoutes) ixNet.setAttribute(ipv4PrefixPool, '-numberOfAddresses', totalRoutes) ixNet.commit() return print '\nModifyBgpNumberOfRoutesNgpf Error: No such networkGroupName: %s' % networkGroupName