def CreateIpv4NgpfPy(ethernetObj, ipv4Name='', ipv4StartValue=None, ipv4Step='0.0.0.1', ipv4Direction='increment', ipv4PrefixStartValue=None, ipv4PrefixStep='0', ipv4PrefixDirection='incremnet', gatewayIpStartValue=None, gatewayIpStep='0.0.0.1', gatewayIpDirection='increment'): # Example: # ipv4Obj = CreateIpv4NgpfPy(ethernet1, 'ipv4-1', ipv4StartValue='1.1.1.1', gatewayIpStartValue='1.1.1.2', ipv4PrefixStartValue='24') print '\nCreateIpv4StackNgpf: %s : %s' % (ethernetObj, ipv4Name) ipv4Obj = ixNet.add(ethernetObj, 'ipv4') if ipv4Name != '': ixNet.setAttribute(ipv4Obj, '-name', ipv4Name) ixNet.commit() if ipv4StartValue != None: # ::ixNet::OBJ-/multivalue:2 ipv4Multivalue = ixNet.getAttribute(ipv4Obj, '-address') ixNet.setMultiAttribute(ipv4Multivalue, '-clearOverlays', 'true', '-pattern', 'counter' ) # ::ixNet::OBJ-/multivalue:2/counter ipv4MultivalueCounter = ixNet.add(ipv4Multivalue, 'counter') ixNet.setMultiAttribute(ipv4MultivalueCounter, '-start', ipv4StartValue, '-step', ipv4Step, '-direction', ipv4Direction ) if ipv4PrefixStartValue != None: prefixMultivalue = ixNet.getAttribute(ipv4Obj, '-prefix') ixNet.setMultiAttribute(prefixMultivalue, '-clearOverlays', 'true', '-pattern', 'conter' ) prefixMultivalueCounter = ixNet.add(prefixMultivalue, 'counter') ixNet.setMultiAttribute(prefixMultivalueCounter, '-start', ipv4PrefixStartValue, '-step', ipv4PrefixStep, '-direction', ipv4PrefixDirection ) if gatewayIpStartValue != None: gatewayMultivalue = ixNet.getAttribute(ipv4Obj, '-gatewayIp') ixNet.setMultiAttribute(gatewayMultivalue, '-clearOverlays', 'true', '-pattern', 'counter' ) gatewayMultivalueCounter = ixNet.add(gatewayMultivalue, 'counter') ixNet.setMultiAttribute(gatewayMultivalueCounter, '-start', gatewayIpStartValue, '-step', gatewayIpStep, '-direction', gatewayIpDirection ) ixNet.commit() return ipv4Obj