port = 6633 c0 = RemoteController('c0',ip=ip,port=port) net = Mininet(topo=simple, controller=c0, link=TCLink) net.start() #switch1,2 flow rules paths = input("Number of paths?: ") path = '' path2 = '' for i in range(1,paths+1): if i == 1: path += 'bucket=weight=1,output:' + str(l1/l2+i) else: path += ',bucket=weight=1,output:' + str(l1/l2+i) for i in range(1, l2+1): c0.cmd('ovs-ofctl -O OpenFlow13 add-group s%s group_id=%s,type=select,%s' %(i, i, path)) for i in range(1,l1/l2+1): if i == 1: path2 += str(i) else: path2 += ',' + str(i) for i in range(1, l2+1): for j in range(1, l1/l2+1): c0.cmd('ovs-ofctl -O OpenFlow13 add-flow s%s in_port=%s,actions=group:%s' %(i,j,i)) for i in range(1, l2+1): for j in range(l1/l2+1, l1/l2+paths+1): c0.cmd('ovs-ofctl -O OpenFlow13 add-flow s%s in_port=%s,actions=output:%s' %(i,j,path2)) #switch3,4,5,6 flow rules for i in range(l2+1, l2+l3+1):