def mn_from_gml(normal, assign_ip, end_hosts, routing, ryuo_ip, mn_wait, gml_file, openflow, local_app_dir, local_apps, ping_all): RyuoOVSSwitch.setup() subprocess.call(['mn', '-c']) if normal: net = Mininet(topo=RyuoTopoFromTopoZoo(gml_file, openflow, local_app_dir), switch=OVSSwitch, controller=RemoteController, host=TestingHost, link=TCLink) else: net = Mininet(topo=RyuoTopoFromTopoZoo(gml_file, openflow, local_app_dir, ' '.join(local_apps)), switch=RyuoOVSSwitch, controller=RemoteController, host=TestingHost, link=TCLink) net_num = 1 ips = [] if assign_ip: net_num, ips = assign_ip_to_switches(net_num, net, ips) if assign_ip and end_hosts: net_num, ips = attach_host_to_switches(net_num, net, ips) net.start() time.sleep(mn_wait) add_addresses(ips, ryuo_ip) if routing: request_routing(ryuo_ip) time.sleep(5) if ping_all: net.pingAll() return net
def on_all_apps_up(self): time.sleep(3) add_addresses(self.ips_to_assign, '127.0.0.1') time.sleep(2) # curl -X POST http://127.0.0.1:8080/router/routing subprocess.call( ['curl', '-X', 'POST', 'http://127.0.0.1:8080/router/routing'])
parser.add_argument('-c', '--controller-ip', required=True) parser.add_argument('-o', '--normal-openflow', default=False, action='store_true') parser.add_argument('-n', '--number-of-switches', default=10, type=int) args = parser.parse_args() if args.normal_openflow: net = Mininet(topo=ManySwitchesTopo(args.number_of_switches), switch=OVSSwitch, controller=RemoteController('c1', ip=args.controller_ip), host=TestingHost) else: net = None pass try: net.start() time.sleep(10) address = [['10.0.%d.1/24' % i, i + 1, 1] for i in range(args.number_of_switches)] add_addresses(address, args.controller_ip) # CLI(net) time.sleep(1) for i, host in enumerate(net.hosts): host.sendCmd( 'ping 10.0.%d.1 -i 0.5 > data/pings/%d.txt' % (i, i)) time.sleep(20) except Exception as e: print e finally: net.stop()
#!/usr/bin/env python2 from ryuo.tests.utils import add_addresses IP = '127.0.0.1' if __name__ == '__main__': # IP Router Port addresses = [['10.0.1.1/24', 1, 1], ['10.0.2.1/24', 1, 2], ['10.0.3.1/24', 1, 3], ['10.0.2.2/24', 2, 1], ['10.0.4.1/24', 2, 2], ['10.0.3.2/24', 3, 1], ['10.0.4.2/24', 3, 2], ['10.0.5.1/24', 3, 3], ['10.0.6.1/24', 3, 4], ['10.0.5.2/24', 4, 1], ['10.0.7.1/24', 4, 2], ['10.0.7.2/24', 5, 1], ['10.0.8.1/24', 5, 2], ['10.0.9.1/24', 6, 1], ['10.0.6.2/24', 6, 2], ['10.0.8.2/24', 6, 3]] add_addresses(addresses, IP)