def test_verify_host_status_in_onos_controller_with_removing_one_mininet_host(self,switches=5): try: topo = LinearTopo(switches) net = Mininet( topo=topo, build=False) net.start() ctrl = net.addController( 'onos', controller=RemoteController, ip=self.controller, port=6653) for switch in net.switches: switch.start( [ctrl] ) response = net.pingAll() log.info('pingall response is %s'%response) assert_equal(response,0.0) self.cliEnter() hosts = json.loads(self.cli.hosts(jsonFormat = True)) log.info('Discovered Hosts are %s'%hosts) assert_equal(len(hosts),switches) log.info('removing host h2') net.delNode(net.hosts[0]) hosts = json.loads(self.cli.hosts(jsonFormat = True)) assert_equal(len(hosts),switches-1) self.cliExit() net.stop() except Exception as Error: log.info('Got error %s while creating topology'%Error) Cleanup.cleanup() raise Cleanup.cleanup()
def test_verifying_nodes_removed_in_mininet_status_in_onos_controller(self,switches=50, delete=20): try: topo = LinearTopo(switches) net = Mininet(topo=topo) net.start() o1_ctrl = net.addController( 'onos', controller=RemoteController, ip=self.controller, port=6653) for switch in net.switches: log.info('switch is %s'%switch) switch.start([o1_ctrl]) time.sleep(5) self.cliEnter() devices = json.loads(self.cli.devices(jsonFormat = True)) device_list = [] count = 0 for device in devices: device_list.append(str(device['id'])) log.info('device list is %s'%device_list) for switch in net.switches: switch_id = 'of:'+switch.dpid if switch_id in device_list: count += 1 assert_equal(count,switches) count = 0 dltd_list = [] for switch in net.switches: log.info('Switch is %s'%switch) dltd_list.append('of:'+switch.dpid) net.delNode(switch) count += 1 if count == delete: break log.info('deleted switch dpid\'s %s'%dltd_list) count = 0 devices = json.loads(self.cli.devices(jsonFormat = True)) for device in devices: if str(device['id']) in dltd_list: assert_equal(str(device['available']), 'False') count += 1 assert_equal(count,delete) self.cliExit() net.stop() except Exception as Error: log.info('Got unexpected error %s while creating topology'%Error) Cleanup.cleanup() raise Cleanup.cleanup()
def test_verifying_udp_bandwidth_between_mininet_hosts_using_iperf_with_one_host_removed(self,switches=3): try: topo = LinearTopo(switches) net = Mininet(topo=topo) net.start() ctrl = net.addController( 'onos', controller=RemoteController, ip=self.controller, port=6653) for switch in net.switches: switch.start( [ctrl] ) response = net.pingAll() iperf = net.iperf(l4Type='UDP') log.info('Iperf response before host removed is %s'%iperf) assert_equal(len(iperf),3) net.delNode(net.hosts[2]) iperf = net.iperf(l4Type='UDP') log.info('Iperf response after host removed is %s'%iperf) assert_equal(len(iperf),3) net.stop() except Exception as Error: log.info('Got unexpected error %s while creating topology'%Error) Cleanup.cleanup() raise Cleanup.cleanup()
def test_verifying_pingall_with_removing_one_mininet_switch(self,switches=3): try: topo = LinearTopo(switches) net = Mininet(topo=topo) #net.build() net.start() ctrl = net.addController( 'onos', controller=RemoteController, ip=self.controller, port=6653) for switch in net.switches: switch.start( [ctrl] ) response = net.pingAll() log.info('Pingall response before switch delete is %s'%response) assert_equal(response,0.0) log.info('Deleting switch s2') net.delNode(net.switches[1]) response = net.pingAll() log.info('Pingall response after switch delete is %s'%response) assert_not_equal(response,0.0) net.stop() except Exception as Error: log.info('Got error %s while creating topology'%Error) Cleanup.cleanup() raise Cleanup.cleanup()