# adding topology with vxlan and dhcp server print( '# \n######## HOW TO create a topology with DGs and various layers ####### #' ) print('\n\nCreate first topology with DHCPServer chained to VXLAN...') print('\nAdd topology...') ixNet.add(root, 'topology') print('\nUse ixNet.commit() to commit added child under root.') ixNet.commit() print('\nUse ixNet.getList to get newly added child under root.') topS = ixNet.getList(root, 'topology')[0] print('Add virtual port to topology and change its name...') ixNet.setMultiAttribute(topS, '-vports', vports[0], '-name', 'vxlan-server') ixNet.commit() print('Add DeviceGroup for VXLAN...') ixNet.add(topS, 'deviceGroup') ixNet.commit() dgVxlan1 = ixNet.getList(topS, 'deviceGroup')[0] print('Create the VXLAN stack in this DeviceGroup...') print('Add Ethernet layer...') ixNet.add(dgVxlan1, 'ethernet') ixNet.commit() ethV1 = ixNet.getList(dgVxlan1, 'ethernet')[0] print('Add IPv4 layer...') ixNet.add(ethV1, 'ipv4')
ixNet.commit() mac1 = ixNet.getList(dg1, 'ethernet')[0] mac2 = ixNet.getList(dg2, 'ethernet')[0] print "Add ipv4 stacks to ethernets" ixNet.add(mac1, 'ipv4') ixNet.add(mac2, 'ipv4') ixNet.commit() ipv4_1 = ixNet.getList(mac1, 'ipv4')[0] ipv4_2 = ixNet.getList(mac2, 'ipv4')[0] print "Setting multi values for ipv4 addresses" ixNet.setMultiAttribute( ixNet.getAttribute(ipv4_1, '-address') + '/counter', '-start', '22.1.1.1', '-step', '0.0.1.0') ixNet.setMultiAttribute( ixNet.getAttribute(ipv4_1, '-gatewayIp') + '/counter', '-start', '22.1.1.2', '-step', '0.0.1.0') ixNet.setMultiAttribute( ixNet.getAttribute(ipv4_1, '-resolveGateway') + '/singleValue', '-value', 'true') ixNet.setMultiAttribute( ixNet.getAttribute(ipv4_2, '-address') + '/counter', '-start', '22.1.1.2', '-step', '0.0.1.0') ixNet.setMultiAttribute( ixNet.getAttribute(ipv4_2, '-gatewayIp') + '/counter', '-start', '22.1.1.1', '-step', '0.0.1.0') ixNet.setMultiAttribute( ixNet.getAttribute(ipv4_2, '-resolveGateway') + '/singleValue', '-value',
# ######################## Add PPP DGs ####################################### # # adding topology with dhcp server print ('# \n######## HOW TO create a topology with DGs and various layers ##### #') print ('\n\nCreate first topology with PPPServer...') print ('\nAdd topology...') ixNet.add(root, 'topology') print ('\nUse ixNet.commit() to commit added child under root.') ixNet.commit() print ('\nUse ixNet.getList to get newly added child under root.') topS = ixNet.getList(root, 'topology')[0] print ('Add virtual port to topology and change its name...') ixNet.setMultiAttribute(topS, '-vports', vports[0], '-name', 'PPP server') ixNet.commit() print ('Add DeviceGroup for PPP server...') ixNet.add(topS, 'deviceGroup') ixNet.commit() DG1 = ixNet.getList(topS, 'deviceGroup')[0] print ('Create the PPP server stack in this DeviceGroup...') print ('Add Ethernet layer...') ixNet.add(DG1, 'ethernet') ixNet.commit() eth1 = ixNet.getList(DG1, 'ethernet')[0] print ('Add PPP Server layer...') ixNet.add(eth1, 'pppoxserver')
mac1 = ixNet.getList(dg1, 'ethernet')[0] mac2 = ixNet.getList(dg2, 'ethernet')[0] print "Add ipv6 stacks to Ethernet" ixNet.add(mac1, 'ipv6') ixNet.add(mac2, 'ipv6') ixNet.commit() ipv6_1 = ixNet.getList(mac1, 'ipv6')[0] ipv6_2 = ixNet.getList(mac2, 'ipv6')[0] # Setting ipv6 address and ipv6 gateway address print "Setting multi values for ipv6 addresses" ixNet.setMultiAttribute( ixNet.getAttribute(ipv6_1, '-address') + '/counter', '-start', '2000:0:0:1:0:0:0:2', '-step', '0:0:0:1:0:0:0:0') ixNet.setMultiAttribute( ixNet.getAttribute(ipv6_1, '-gatewayIp') + '/counter', '-start', '2000:0:0:1:0:0:0:1', '-step', '0:0:0:1:0:0:0:0') ixNet.setMultiAttribute( ixNet.getAttribute(ipv6_1, '-resolveGateway') + '/singleValue', '-value', 'true') ixNet.setMultiAttribute( ixNet.getAttribute(ipv6_2, '-address') + '/counter', '-start', '2000:0:0:1:0:0:0:1', '-step', '0:0:0:1:0:0:0:0') ixNet.setMultiAttribute( ixNet.getAttribute(ipv6_2, '-gatewayIp') + '/counter', '-start', '2000:0:0:1:0:0:0:2', '-step', '0:0:0:1:0:0:0:0') ixNet.setMultiAttribute( ixNet.getAttribute(ipv6_2, '-resolveGateway') + '/singleValue', '-value',
ixNet.add(dg2, 'ethernet') ixNet.commit() mac1 = ixNet.getList(dg1, 'ethernet')[0] mac2 = ixNet.getList(dg2, 'ethernet')[0] print ("Add ipv4 stacks to Ethernets") ixNet.add(mac1, 'ipv4') ixNet.add(mac2, 'ipv4') ixNet.commit() ipv4_1 = ixNet.getList(mac1, 'ipv4')[0] ipv4_2 = ixNet.getList(mac2, 'ipv4')[0] print ("Setting multi values for ipv4 addresses") ixNet.setMultiAttribute(ixNet.getAttribute(ipv4_1, '-address') + '/counter', '-start', '22.1.1.1', '-step', '0.0.1.0') ixNet.setMultiAttribute(ixNet.getAttribute(ipv4_1, '-gatewayIp') + '/counter', '-start', '22.1.1.2', '-step', '0.0.1.0') ixNet.setMultiAttribute(ixNet.getAttribute(ipv4_1, '-resolveGateway') + '/singleValue', '-value', 'true') ixNet.setMultiAttribute(ixNet.getAttribute(ipv4_2, '-address') + '/counter', '-start', '22.1.1.2', '-step', '0.0.1.0') ixNet.setMultiAttribute(ixNet.getAttribute(ipv4_2, '-gatewayIp') + '/counter', '-start', '22.1.1.1', '-step', '0.0.1.0') ixNet.setMultiAttribute(ixNet.getAttribute(ipv4_2, '-resolveGateway') + '/singleValue', '-value', 'true') ixNet.commit() ################################################################################ # Assign ports ################################################################################ vports = ixNet.getList(ixNet.getRoot(), 'vport') print ("Assigning ports to " + str(vports) + " ...") assignPorts = ixNet.execute('assignPorts', py.ports, [], ixNet.getList("/","vport"), True) if assignPorts != vports: raise TestFailedError("FAILED assigning ports. Got %s" %assignPorts)
time.sleep(5) ixNet.execute('clearStats') # ######################## Add gPTP Master and gPTP Slave ############################ # # adding topology with gPTP Master and gPTP Slave print('\n\nCreate first topology with gPTP master...') print('\nAdd topology...') ixNet.add(root, 'topology') print('\nUse ixNet.commit() to commit added child under root.') ixNet.commit() print('\nUse ixNet.getList to get newly added child under root.') topM = ixNet.getList(root, 'topology')[0] print('Add virtual port to topology and change its name...') ixNet.setMultiAttribute(topM, '-vports', vports[0], '-name', '802.1AS Master') ixNet.commit() print('Add DeviceGroup for 802.1AS...') ixNet.add(topM, 'deviceGroup') ixNet.commit() dg_gPTP_m = ixNet.getList(topM, 'deviceGroup')[0] print('Create the Ethernet stack in this DeviceGroup...') print('Add Ethernet layer...') ixNet.add(dg_gPTP_m, 'ethernet') ixNet.commit() ethM = ixNet.getList(dg_gPTP_m, 'ethernet')[0] print('Add PTP layer...') ixNet.add(ethM, 'ptp')
print('\nAdd topology...') ixNet.add(root, 'topology') print('\nUse ixNet.commit() to commit added child under root.') ixNet.commit() print('\nUse ixNet.getList to get newly added child under root.') topANCP = ixNet.getList(root, 'topology')[0] print('Add virtual port to topology and change its name...') ixNet.setMultiAttribute(topANCP, '-vports', vports[0], '-name', 'AN Topology') ixNet.commit() print('Add DeviceGroup for ANCP...') ixNet.add(topANCP, 'deviceGroup') ixNet.commit() DG = ixNet.getList(topANCP, 'deviceGroup')[0] print('Create the ANCP stack in this DeviceGroup...') print('Add Ethernet layer...')
addedEthernetID = ixNet.remapIds(addedEthernet)[0] addedIPv4 = ixNet.add(addedEthernetID, 'ipv4') ixNet.commit() addedIPv4ID = ixNet.remapIds(addedIPv4)[0] #------------------------------------ # Configure 1st topology #------------------------------------ addressMV = ixNet.getAttribute(addedIPv4, '-address') ixNet.setMultiAttribute( addressMV + '/counter', '-step', '0.0.0.1', '-start', '201.1.0.1', '-direction', 'increment', ) ixNet.commit() prefixMV = ixNet.getAttribute(addedIPv4, '-prefix') ixNet.setMultiAttribute(prefixMV + '/singleValue', '-value', '16') ixNet.commit() gatewayMV = ixNet.getAttribute(addedIPv4, '-gatewayIp') ixNet.setMultiAttribute( gatewayMV + '/counter', '-step', '0.0.0.1',
################################################################################ # Configure Ethernet Traffic ################################################################################ print ('') print ("Creating Traffic for Eth") ixNet.add(ixNet.getRoot() + '/traffic', 'trafficItem') ixNet.commit() ti1 = ixNet.getList(ixNet.getRoot() + '/traffic', 'trafficItem')[0] ixNet.setMultiAttribute( ti1, '-name' ,'Traffic Eth', '-trafficType' ,'ethernetVlan', '-allowSelfDestined' ,False, '-trafficItemType' ,'L2L3', '-mergeDestinations' ,True, '-egressEnabled' ,False, '-srcDestMesh' ,'manyToMany', '-enabled' ,True, '-routeMesh' ,'fullMesh', '-transmitMode' ,'interleaved', '-biDirectional' ,True, '-hostsPerNetwork' ,1) ixNet.commit() ixNet.setAttribute(ti1, '-trafficType', 'ethernetVlan') ixNet.commit() ixNet.add(ti1, 'endpointSet', '-sources', mac1, '-destinations', mac2, '-name', 'ep-set1', '-sourceFilter', '', '-destinationFilter', '')
ixNet.setAttribute(vports[1], '-connectedTo', '/availableHardware/chassis:"10.39.64.117"/card:2/port:6') ixNet.commit() time.sleep(5) print( "*************************************************************************************************" ) print('\n\nCreate Home Gateway topology \n\n') print( "*************************************************************************************************" ) print('\nAdding Home Gateway topology...') hg_topology = ixNet.add(root, 'topology') ixNet.setMultiAttribute(hg_topology, '-name', 'Home Gateway', '-ports', vport1) print('\nUse ixNet.commit() to commit added child under root.') ixNet.commit() print('\n.........Adding Bonded GRE LTE...............') lte_device = ixNet.add(hg_topology, 'deviceGroup') ixNet.setMultiAttribute(lte_device, '-multiplier', '1', '-name', 'LTE Device Group') ixNet.commit() # Adding Bonded GRE LTE print('\nAdd Ethernet to LTE ...') ethernet1 = ixNet.add(lte_device, 'ethernet') ixNet.commit() mac = ixNet.getAttribute(ethernet1, '-mac') mac_val = ixNet.add(mac, 'counter')
# ######################## Add DHCP DGs ####################################### # # adding topology with dhcp server print ('# \n######## HOW TO create a topology with DGs and various layers ##### #') print ('\n\nCreate first topology with DHCPServer...') print ('\nAdd topology...') ixNet.add(root, 'topology') print ('\nUse ixNet.commit() to commit added child under root.') ixNet.commit() print ('\nUse ixNet.getList to get newly added child under root.') topS = ixNet.getList(root, 'topology')[0] print ('Add virtual port to topology and change its name...') ixNet.setMultiAttribute(topS, '-vports', vports[0], '-name', 'DHCPserver') ixNet.commit() print ('Add DeviceGroup for DHCPserver...') ixNet.add(topS, 'deviceGroup') ixNet.commit() DG1 = ixNet.getList(topS, 'deviceGroup')[0] print ('Create the DHCPserver stack in this DeviceGroup...') print ('Add Ethernet layer...') ixNet.add(DG1, 'ethernet') ixNet.commit() eth1 = ixNet.getList(DG1, 'ethernet')[0] print ('Add IPv4 layer...') ixNet.add(eth1, 'ipv4')
# adding topology with dhcp server print( '# \n######## HOW TO create a topology with DGs and various layers ##### #' ) print('\n\nCreate first topology with DHCPServer...') print('\nAdd topology...') ixNet.add(root, 'topology') print('\nUse ixNet.commit() to commit added child under root.') ixNet.commit() print('\nUse ixNet.getList to get newly added child under root.') topS = ixNet.getList(root, 'topology')[0] print('Add virtual port to topology and change its name...') ixNet.setMultiAttribute(topS, '-vports', vports[0], '-name', 'DHCPserver') ixNet.commit() print('Add DeviceGroup for DHCPserver...') ixNet.add(topS, 'deviceGroup') ixNet.commit() DG1 = ixNet.getList(topS, 'deviceGroup')[0] print('Create the DHCPserver stack in this DeviceGroup...') print('Add Ethernet layer...') ixNet.add(DG1, 'ethernet') ixNet.commit() eth1 = ixNet.getList(DG1, 'ethernet')[0] print('Add IPv4 layer...') ixNet.add(eth1, 'ipv6')
ixNet.commit() mac1 = ixNet.getList(dg1, 'ethernet')[0] mac2 = ixNet.getList(dg2, 'ethernet')[0] print "Add ipv6 stacks to ethernets" ixNet.add(mac1, 'ipv6') ixNet.add(mac2, 'ipv6') ixNet.commit() ipv6_1 = ixNet.getList(mac1, 'ipv6')[0] ipv6_2 = ixNet.getList(mac2, 'ipv6')[0] print "Setting multi values for ipv6 addresses" ixNet.setMultiAttribute( ixNet.getAttribute(ipv6_1, '-address') + '/counter', '-start', '2200:0:0:0:0:0:0:1', '-step', '0:0:0:1:0:0:0:0') ixNet.setMultiAttribute( ixNet.getAttribute(ipv6_1, '-gatewayIp') + '/counter', '-start', '2200:0:0:0:0:0:0:2', '-step', '0:0:0:1:0:0:0:0') ixNet.setMultiAttribute( ixNet.getAttribute(ipv6_1, '-resolveGateway') + '/singleValue', '-value', 'true') ixNet.setMultiAttribute( ixNet.getAttribute(ipv6_1, '-prefix') + '/singleValue', '-value', '64') ixNet.setMultiAttribute( ixNet.getAttribute(ipv6_2, '-address') + '/counter', '-start', '2200:0:0:0:0:0:0:2', '-step', '0:0:0:1:0:0:0:0') ixNet.setMultiAttribute( ixNet.getAttribute(ipv6_2, '-gatewayIp') + '/counter', '-start', '2200:0:0:0:0:0:0:1', '-step', '0:0:0:1:0:0:0:0')
print "**************************************************************************************************" print('\n\nCreate topology with PPPoX client and PPPoX Server \n\n') print "***************************************************************************************************" print('\nAdd topology...') ixNet.add(root, 'topology') print('\nUse ixNet.commit() to commit added child under root.') ixNet.commit() print('\nUse ixNet.getList to get newly added child under root.') topS = ixNet.getList(root, 'topology')[0] print('Add virtual port to topology and change its name...') ixNet.setMultiAttribute(topS, '-vports', vports[0], '-name', 'pppoxclient') ixNet.commit() print('Add DeviceGroup for pppoxclient...') ixNet.add(topS, 'deviceGroup') ixNet.commit() DG1 = ixNet.getList(topS, 'deviceGroup')[0] print('Create the pppoxclient stack in this DeviceGroup...') print('Add Ethernet layer...') ixNet.add(DG1, 'ethernet') ixNet.commit() eth1 = ixNet.getList(DG1, 'ethernet')[0] print('Add PPPoX client layer...') ixNet.add(eth1, 'pppoxclient')
ixNet.commit() mac1 = ixNet.getList(dg1, 'ethernet')[0] mac2 = ixNet.getList(dg2, 'ethernet')[0] print("Add ipv4 stacks to ethernets") ixNet.add(mac1, 'ipv4') ixNet.add(mac2, 'ipv4') ixNet.commit() ipv4_1 = ixNet.getList(mac1, 'ipv4')[0] ipv4_2 = ixNet.getList(mac2, 'ipv4')[0] print("Setting multi values for ipv4 addresses") ixNet.setMultiAttribute( ixNet.getAttribute(ipv4_1, '-address') + '/counter', '-start', '22.1.1.1', '-step', '0.0.1.0') ixNet.setMultiAttribute( ixNet.getAttribute(ipv4_1, '-gatewayIp') + '/counter', '-start', '22.1.1.2', '-step', '0.0.1.0') ixNet.setMultiAttribute( ixNet.getAttribute(ipv4_1, '-resolveGateway') + '/singleValue', '-value', 'true') ixNet.setMultiAttribute( ixNet.getAttribute(ipv4_2, '-address') + '/counter', '-start', '22.1.1.2', '-step', '0.0.1.0') ixNet.setMultiAttribute( ixNet.getAttribute(ipv4_2, '-gatewayIp') + '/counter', '-start', '22.1.1.1', '-step', '0.0.1.0') ixNet.setMultiAttribute( ixNet.getAttribute(ipv4_2, '-resolveGateway') + '/singleValue', '-value',