import os from IxNetwork import IxNet ixNet = IxNet() print("Connecting to the server") ixNet.connect('10.39.65.1', '-setAttribute', 'strict', '-port', 9863, '-version', '9.00') print("Cleaning up IxNetwork...") ixNet.execute('newConfig') root = ixNet.getRoot() print("\nAdd virtual ports to configuration...") vports = ixNet.getList(ixNet.getRoot(), 'vport') print('Add chassis in IxNetwork...') chassis = '10.39.64.117' availableHardwareId = ixNet.getRoot() + 'availableHardware' ixNet.add(availableHardwareId, 'chassis', '-hostname', chassis) ixNet.commit() time.sleep(5) ############################################################################### # 1. Adding ports to configuration ################################################################################ print "Adding ports to configuration" root = ixNet.getRoot() ixNet.add(root, 'vport') ixNet.add(root, 'vport')
ixNet.connect('localhost', '-port', 8009, '-version', '7.30') print("Cleaning up IxNetwork...") ixNet.execute('newConfig') # all objects are under root root = ixNet.getRoot() print("\nAdd virtual ports to configuration...") vports = [] vports.append(ixNet.add(root, 'vport')) vports.append(ixNet.add(root, 'vport')) ixNet.commit() # get virtual ports vports = ixNet.getList(ixNet.getRoot(), 'vport') print('Add chassis in IxNetwork...') chassis = '10.205.15.184' availableHardwareId = ixNet.getRoot() + 'availableHardware' ixNet.add(availableHardwareId, 'chassis', '-hostname', chassis) ixNet.commit() print("Assigning ports from " + chassis + " to " + str(vports) + " ...") ixNet.setAttribute(vports[0], '-connectedTo', '/availableHardware/chassis:"10.205.15.184"/card:9/port:2') ixNet.setAttribute( vports[1], '-connectedTo', '/availableHardware/chassis:"10.205.15.184"/card:9/port:10') ixNet.commit()
ixNet.connect('localhost', '-port', 8009, '-version', '7.40') print("Cleaning up IxNetwork...") ixNet.execute('newConfig') # all objects are under root root = ixNet.getRoot() print("\nAdd virtual ports to configuration...") vports = [] vports.append(ixNet.add(root, 'vport')) vports.append(ixNet.add(root, 'vport')) ixNet.commit() # get virtual ports vports = ixNet.getList(ixNet.getRoot(), 'vport') print('Add chassis in IxNetwork...') chassis = '10.205.15.90' availableHardwareId = ixNet.getRoot() + 'availableHardware' ixNet.add(availableHardwareId, 'chassis', '-hostname', chassis) ixNet.commit() print("Assigning ports from " + chassis + " to " + str(vports) + " ...") ixNet.setAttribute(vports[0], '-connectedTo', '/availableHardware/chassis:"10.205.15.90"/card:1/port:1') ixNet.setAttribute(vports[1], '-connectedTo', '/availableHardware/chassis:"10.205.15.90"/card:1/port:2') ixNet.commit() print("Rebooting ports...") jobs = [ixNet.setAsync().execute('resetPortCpu', vp) for vp in vports]
ixNet.connect('localhost', '-port', 8009, '-version', '7.30') print ("Cleaning up IxNetwork...") ixNet.execute('newConfig') # all objects are under root root = ixNet.getRoot() print ("\nAdd virtual ports to configuration...") vports = [] vports.append(ixNet.add(root, 'vport')) vports.append(ixNet.add(root, 'vport')) ixNet.commit() # get virtual ports vports = ixNet.getList(ixNet.getRoot(), 'vport') print ('Add chassis in IxNetwork...') chassis = '10.205.15.184' availableHardwareId = ixNet.getRoot()+'availableHardware' ixNet.add(availableHardwareId, 'chassis', '-hostname', chassis) ixNet.commit() print ("Assigning ports from " + chassis + " to "+ str(vports) + " ...") ixNet.setAttribute(vports[0], '-connectedTo', '/availableHardware/chassis:"10.205.15.184"/card:9/port:2') ixNet.setAttribute(vports[1], '-connectedTo', '/availableHardware/chassis:"10.205.15.184"/card:9/port:10') ixNet.commit() print ("Rebooting ports...")
################################################################################ # Cleaning up IxNetwork ################################################################################ print "Cleaning up IxNetwork..." ixNet.execute('newConfig') ################################################################################ # Adding ports to configuration ################################################################################ print "Adding ports to configuration" root = ixNet.getRoot() ixNet.add(root, 'vport') ixNet.add(root, 'vport') ixNet.commit() vPorts = ixNet.getList(root, 'vport') vport1 = vPorts[0] vport2 = vPorts[1] ################################################################################ # Adding VXLAN Protocol ################################################################################ print "Add topologies" ixNet.add(root, 'topology') ixNet.add(root, 'topology') ixNet.commit() topo1 = ixNet.getList(root, 'topology')[0] topo2 = ixNet.getList(root, 'topology')[1]
################################################################################ # Cleaning up IxNetwork ################################################################################ print ("Cleaning up IxNetwork...") ixNet.execute('newConfig') ################################################################################ # Adding ports to configuration ################################################################################ print ("Adding ports to configuration") root = ixNet.getRoot() ixNet.add(root, 'vport') ixNet.add(root, 'vport') ixNet.commit() vPorts = ixNet.getList(root, 'vport') vport1 = vPorts[0] vport2 = vPorts[1] ################################################################################ # Adding IPv4 endpoints to configuration ################################################################################ print ("Add topologies") ixNet.add(root, 'topology') ixNet.add(root, 'topology') ixNet.commit() topo1 = ixNet.getList(root, 'topology')[0] topo2 = ixNet.getList(root, 'topology')[1] print ("Add ports to topologies")
# all objects are under root root = ixNet.getRoot() print("\nAdd one virtual port to configuration...") vports = [] vports.append(ixNet.add(root, 'vport')) ixNet.commit() # get virtual ports vports = ixNet.getList(ixNet.getRoot(), 'vport') print('Add chassis in IxNetwork...') chassis = '10.205.15.184' availableHardwareId = ixNet.getRoot() + 'availableHardware' ixNet.add(availableHardwareId, 'chassis', '-hostname', chassis) ixNet.commit() print("Assigning ports from " + chassis + " to " + str(vports) + " ...") ixNet.setAttribute(vports[0], '-connectedTo', '/availableHardware/chassis:"10.205.15.184"/card:9/port:2')
# Cleaning up IxNetwork ################################################################################ print "Cleaning up IxNetwork..." ixNet.execute('newConfig') ################################################################################ # Adding ports to configuration ################################################################################ print "Adding ports to configuration" root = ixNet.getRoot() ixNet.add(root, 'vport') ixNet.add(root, 'vport') ixNet.commit() vPorts = ixNet.getList(root, 'vport') vport1 = vPorts[0] vport2 = vPorts[1] ################################################################################ # Configuring IPv4 Endpoints ################################################################################ print "Add topologies" ixNet.add(root, 'topology') ixNet.add(root, 'topology') ixNet.commit() topo1 = ixNet.getList(root, 'topology')[0] topo2 = ixNet.getList(root, 'topology')[1]
################################################################################ # Cleaning up IxNetwork ################################################################################ print "Cleaning up IxNetwork..." ixNet.execute('newConfig') ################################################################################ # Adding ports to configuration ################################################################################ print "Adding ports to configuration" root = ixNet.getRoot() ixNet.add(root, 'vport') ixNet.add(root, 'vport') ixNet.commit() vPorts = ixNet.getList(root, 'vport') vport1 = vPorts[0] vport2 = vPorts[1] ################################################################################ # Configuring Ethernet ################################################################################ print "Add topologies" ixNet.add(root, 'topology') ixNet.add(root, 'topology') ixNet.commit() topo1 = ixNet.getList(root, 'topology')[0] topo2 = ixNet.getList(root, 'topology')[1] print "Add ports to topologies"
print("Connecting to the server") ixNet.connect('10.39.65.1', '-setAttribute', 'strict', '-port', 9862, '-version', '9.00') print("Cleaning up IxNetwork...") ixNet.execute('newConfig') config_file = "bonded_gre_sample_script.ixncfg" print("Loading sample configuration " + config_file + "...") ixNet.execute('loadConfig', ixNet.readFrom(config_file)) print("Successfully loaded .ixncfg file !!!") root = ixNet.getRoot() # get virtual ports vports = ixNet.getList(ixNet.getRoot(), 'vport') print('Add chassis in IxNetwork...') chassis = '10.39.64.117' availableHardwareId = ixNet.getRoot() + 'availableHardware' ixNet.add(availableHardwareId, 'chassis', '-hostname', chassis) ixNet.commit() vport1 = vports[0] vport2 = vports[1] print("Assigning ports from " + chassis + " to " + str(vports) + " ...") ixNet.setAttribute(vports[0], '-connectedTo', '/availableHardware/chassis:"10.39.64.117"/card:2/port:5') ixNet.setAttribute(vports[1], '-connectedTo', '/availableHardware/chassis:"10.39.64.117"/card:2/port:6') ixNet.commit() time.sleep(5)
ixNet.connect('ixro-smqa-r-22', '-setAttribute', 'strict', '-port', 8009, '-version', '7.40') print ("Cleaning up IxNetwork...") ixNet.execute('newConfig') # all objects are under root root = ixNet.getRoot() print ("\nAdd virtual ports to configuration...") vports = [] vports.append(ixNet.add(root, 'vport')) vports.append(ixNet.add(root, 'vport')) ixNet.commit() # get virtual ports vports = ixNet.getList(ixNet.getRoot(), 'vport') print ('Add chassis in IxNetwork...') chassis = '10.205.15.90' availableHardwareId = ixNet.getRoot()+'availableHardware' ixNet.add(availableHardwareId, 'chassis', '-hostname', chassis) ixNet.commit() print ("Assigning ports from " + chassis + " to "+ str(vports) + " ...") ixNet.setAttribute(vports[0], '-connectedTo', '/availableHardware/chassis:"10.205.15.90"/card:11/port:3') ixNet.setAttribute(vports[1], '-connectedTo', '/availableHardware/chassis:"10.205.15.90"/card:11/port:4') ixNet.commit() # print ("Rebooting ports...") # jobs = [ixNet.setAsync().execute('resetPortCpu', vp) for vp in vports]
ixNet.connect('10.39.64.169', '-setAttribute', 'strict', '-port', 8876, '-version', '9.00') print("Cleaning up IxNetwork...") ixNet.execute('newConfig') root = ixNet.getRoot() print("\nAdd virtual ports to configuration...") vports = [] vports.append(ixNet.add(root, 'vport')) vports.append(ixNet.add(root, 'vport')) ixNet.commit() # get virtual ports vports = ixNet.getList(ixNet.getRoot(), 'vport') print('Add chassis in IxNetwork...') chassis = '10.39.65.151' availableHardwareId = ixNet.getRoot() + 'availableHardware' ixNet.add(availableHardwareId, 'chassis', '-hostname', chassis) ixNet.commit() print("Assigning ports from " + chassis + " to " + str(vports) + " ...") ixNet.setAttribute(vports[0], '-connectedTo', '/availableHardware/chassis:"10.39.65.151"/card:9/port:1') ixNet.setAttribute(vports[1], '-connectedTo', '/availableHardware/chassis:"10.39.65.151"/card:9/port:2') ixNet.commit() time.sleep(5)
################################################################################ # Cleaning up IxNetwork ################################################################################ print "Cleaning up IxNetwork..." ixNet.execute('newConfig') ################################################################################ # Adding ports to configuration ################################################################################ print "Adding ports to configuration" root = ixNet.getRoot() ixNet.add(root, 'vport') ixNet.add(root, 'vport') ixNet.commit() vPorts = ixNet.getList(root, 'vport') vport1 = vPorts[0] vport2 = vPorts[1] ################################################################################ # Adding IPv4 endpoints to configuration ################################################################################ print "Add topologies" ixNet.add(root, 'topology') ixNet.add(root, 'topology') ixNet.commit() topo1 = ixNet.getList(root, 'topology')[0] topo2 = ixNet.getList(root, 'topology')[1] print "Add ports to topologies"
# Clearing Statistics for AppLibrary Traffic #---------------------------------------------------------- print("\nWaiting 10 seconds before clearing AppLibrary statistics ...") time.sleep(10) ixNet.execute('clearAppLibraryStats') print("Statistics have been cleared") #---------------------------------------------------------- # Drilling down per IP #---------------------------------------------------------- time.sleep(10) print("Drilling down to reveal per IP address flow activity") viewsList = ixNet.getList(root + '/statistics', 'view') target = viewsList[viewsList.index( '::ixNet::OBJ-/statistics/view:"Application Traffic Item Statistics"')] print("Configuring drill down per IP addresses") ixNet.setAttribute(target + '/drillDown', '-targetRowIndex', '0') ixNet.commit() ixNet.setAttribute(target + '/drillDown', '-targetDrillDownOption', 'Application Traffic:Per IPs') ixNet.commit() ixNet.setAttribute(target + '/drillDown', '-targetRow', 'Traffic Item=Traffic Item') ixNet.commit() print("Launching the drill down per IP addresses view\n")
################################################################################ # Cleaning up IxNetwork ################################################################################ print("Cleaning up IxNetwork...") ixNet.execute('newConfig') ################################################################################ # Adding ports to configuration ################################################################################ print("Adding ports to configuration") root = ixNet.getRoot() ixNet.add(root, 'vport') ixNet.add(root, 'vport') ixNet.commit() vPorts = ixNet.getList(root, 'vport') vport1 = vPorts[0] vport2 = vPorts[1] ################################################################################ # Configuring IPv6 Autoconfiguration ################################################################################ print("Add topologies") ixNet.add(root, 'topology') ixNet.add(root, 'topology') ixNet.commit() topo1 = ixNet.getList(root, 'topology')[0] topo2 = ixNet.getList(root, 'topology')[1] print("Add ports to topologies")
# Cleaning up IxNetwork ################################################################################ print("Cleaning up IxNetwork...") ixNet.execute('newConfig') ################################################################################ # Adding ports to configuration ################################################################################ print("Adding ports to configuration") root = ixNet.getRoot() ixNet.add(root, 'vport') ixNet.add(root, 'vport') ixNet.commit() vPorts = ixNet.getList(root, 'vport') vport1 = vPorts[0] vport2 = vPorts[1] ################################################################################ # Configuring IPv4 Endpoints ################################################################################ print("Add topologies") ixNet.add(root, 'topology') ixNet.add(root, 'topology') ixNet.commit() topo1 = ixNet.getList(root, 'topology')[0] topo2 = ixNet.getList(root, 'topology')[1]