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.commit() vPorts = ixNet.getList(root, 'vport') vport1 = vPorts[0] vport2 = vPorts[1] print("Assigning ports from " + chassis + " to " + str(vports) + " ...") ixNet.setAttribute(vport1, '-connectedTo', '/availableHardware/chassis:"10.39.64.117"/card:2/port:9') ixNet.setAttribute(vport2, '-connectedTo', '/availableHardware/chassis:"10.39.64.117"/card:2/port:10') ixNet.commit() ################################################################################ # 2. Adding VXLANv6 Protocol ################################################################################ print "Add VxLANv6 topologies" ixNet.add(root, 'topology') ixNet.add(root, 'topology') ixNet.commit() topo1 = ixNet.getList(root, 'topology')[0] topo2 = ixNet.getList(root, 'topology')[1]
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...") jobs = [ixNet.setAsync().execute('resetPortCpu', vp) for vp in vports] for j in jobs: print(j + ' ' + ixNet.getResult(j)) print("Done... Ports are rebooted...") time.sleep(5) ixNet.execute('clearStats')
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] for j in jobs: print j + ' ' + ixNet.getResult(j) print("Done... Ports are rebooted...") time.sleep(5) ixNet.execute('clearStats') # ######################## Add gPTP Master and gPTP Slave ############################ # # adding topology with gPTP Master and gPTP Slave
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...") jobs = [ixNet.setAsync().execute('resetPortCpu', vp) for vp in vports] for j in jobs: print j + ' ' + ixNet.getResult(j) print ("Done... Ports are rebooted...") print ("") time.sleep(5) ixNet.execute('clearStats')
print("Connecting to TCL Server...") ixNet.connect('127.0.0.1', '-version', applicationVersion, '-port', '8449') ixNet.execute('newConfig') root = ixNet.getRoot() availableHW = ixNet.getRoot() + 'availableHardware' #------------------------------------ # Adding chassis #------------------------------------ print("Adding chassis to the configuration") chassis1 = ixNet.add(availableHW, 'chassis') chassis1ID = ixNet.remapIds(chassis1)[0] ixNet.setAttribute(chassis1ID, '-hostname', chassisIP) ixNet.commit() #------------------------------------ # Adding 2 ports #------------------------------------ print("Adding offline ports to the configuration") vport1 = ixNet.add(root, 'vport') ixNet.commit() vport1ID = ixNet.remapIds(vport1)[0] vport2 = ixNet.add(root, 'vport') ixNet.commit() vport2ID = ixNet.remapIds(vport2)[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] print "Add ports to topologies" ixNet.setAttribute(topo1, '-vports', vport1) ixNet.setAttribute(topo2, '-vports', vport2) ixNet.commit() print "Add device groups to topologies" ixNet.add(topo1, 'deviceGroup') ixNet.add(topo2, 'deviceGroup') ixNet.commit() dg1 = ixNet.getList(topo1, 'deviceGroup')[0] dg2 = ixNet.getList(topo2, 'deviceGroup')[0] print "Add Ethernet stacks to device groups" ixNet.add(dg1, 'ethernet') ixNet.add(dg2, 'ethernet') ixNet.commit()
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) print( "*************************************************************************************************" ) print('\n\nCreate Home Gateway topology \n\n') print( "*************************************************************************************************" ) print('\nAdding Home Gateway topology...') hg_topology = ixNet.add(root, 'topology')
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] print "Add ports to topologies" ixNet.setAttribute(topo1, '-vports', vport1) ixNet.setAttribute(topo2, '-vports', vport2) ixNet.commit() print "Add device groups to topologies" ixNet.add(topo1, 'deviceGroup') ixNet.add(topo2, 'deviceGroup') ixNet.commit() dg1 = ixNet.getList(topo1, 'deviceGroup')[0] dg2 = ixNet.getList(topo2, 'deviceGroup')[0] print "Add ethernet stacks to device groups" ixNet.add(dg1, 'ethernet') ixNet.add(dg2, 'ethernet') ixNet.commit()
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] # for j in jobs: # print j + ' ' + ixNet.getResult(j) # print ("Done... Ports are rebooted...") time.sleep(5) ixNet.execute('clearStats')
vport1 = vPorts[0] vport2 = vPorts[1] ################################################################################ # Configuring Ethernet 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] print ("Add ports to topologies") ixNet.setAttribute(topo1, '-vports', vport1) ixNet.setAttribute(topo2, '-vports', vport2) ixNet.commit() print ("Add device groups to topologies") ixNet.add(topo1, 'deviceGroup') ixNet.add(topo2, 'deviceGroup') ixNet.commit() dg1 = ixNet.getList(topo1, 'deviceGroup')[0] dg2 = ixNet.getList(topo2, 'deviceGroup')[0] print ("Add Ethernet stacks to device groups") ixNet.add(dg1, 'ethernet') ixNet.add(dg2, 'ethernet') ixNet.commit()
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...") jobs = [ixNet.setAsync().execute('resetPortCpu', vp) for vp in vports] for j in jobs: print(j + ' ' + ixNet.getResult(j)) print("Done... Ports are rebooted...") time.sleep(5) ixNet.execute('clearStats')
vport1 = vPorts[0] vport2 = vPorts[1] ################################################################################ # Configure 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" ixNet.setAttribute(topo1, '-vports', vport1) ixNet.setAttribute(topo2, '-vports', vport2) ixNet.commit() print "Add device groups to topologies" ixNet.add(topo1, 'deviceGroup') ixNet.add(topo2, 'deviceGroup') ixNet.commit() dg1 = ixNet.getList(topo1, 'deviceGroup')[0] dg2 = ixNet.getList(topo2, 'deviceGroup')[0] print "Add Ethernet stacks to device groups" ixNet.add(dg1, 'ethernet') ixNet.add(dg2, 'ethernet') ixNet.commit()
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) ixNet.execute('clearStats') 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.')
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" ixNet.setAttribute(topo1, '-vports', vport1) ixNet.setAttribute(topo2, '-vports', vport2) ixNet.commit() print "Add device groups to topologies" ixNet.add(topo1, 'deviceGroup') ixNet.add(topo2, 'deviceGroup') ixNet.commit() dg1 = ixNet.getList(topo1, 'deviceGroup')[0] dg2 = ixNet.getList(topo2, 'deviceGroup')[0] print "Add ethernet stacks to device groups" ixNet.add(dg1, 'ethernet') ixNet.add(dg2, 'ethernet') ixNet.commit()
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.commit() print("Rebooting ports...") jobs = [ixNet.setAsync().execute('resetPortCpu', vp) for vp in vports] for j in jobs: print j + ' ' + ixNet.getResult(j) print("Done... Ports are rebooted...") print("")
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") ixNet.setAttribute(topo1, '-vports', vport1) ixNet.setAttribute(topo2, '-vports', vport2) ixNet.commit() print("Add device groups to topologies") ixNet.add(topo1, 'deviceGroup') ixNet.add(topo2, 'deviceGroup') ixNet.commit() dg1 = ixNet.getList(topo1, 'deviceGroup')[0] dg2 = ixNet.getList(topo2, 'deviceGroup')[0] print("Add ethernet stacks to device groups") ixNet.add(dg1, 'ethernet') ixNet.add(dg2, 'ethernet') ixNet.commit()
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] print("Add ports to topologies") ixNet.setAttribute(topo1, '-vports', vport1) ixNet.setAttribute(topo2, '-vports', vport2) ixNet.commit() print("Add device groups to topologies") ixNet.add(topo1, 'deviceGroup') ixNet.add(topo2, 'deviceGroup') ixNet.commit() dg1 = ixNet.getList(topo1, 'deviceGroup')[0] dg2 = ixNet.getList(topo2, 'deviceGroup')[0] print("Add ethernet stacks to device groups") ixNet.add(dg1, 'ethernet') ixNet.add(dg2, 'ethernet') ixNet.commit()