def main(): # Default subnet is required for the host tracker to work. subnet_control = SubnetControl() subnet_control.list() subnet_control.add_subnet("defaultSubnet", "10.0.0.254/8") raw_input("[Press enter when mininet is ready] ") print("-------------------------") # Add per-protocol flows so we can monitor stats that way x = analytics.add_protocol_flows() if (not x): print "Unable to add per-protocol flows" m = WaypointMonitor(Stats.TYPE_SUBNET, subnet="10.0.0.1/32") m.set_waypoint("10.0.0.2") m.set_large_flow_threshold(2000) # 2000 bytes m.start() # Register signal-handler to catch SIG_INT signal.signal(signal.SIGINT, signal_handler) signal.pause() # join() won't return until SIG_INT has been captured m.join()
def main(): # Default subnet is required for the host tracker to work. subnet_control = SubnetControl() subnet_control.list() subnet_control.add_subnet("defaultSubnet", prefix) raw_input("[Press enter when mininet is ready] ") print("-------------------------") m = WaypointMonitor(Stats.TYPE_AL, al="inflows") # m.set_waypoint("10.0.0.2") m.set_high_threshold(rate_high) m.set_low_threshold(rate_low) m.start() # Register signal-handler to catch SIG_INT signal.signal(signal.SIGINT, signal_handler) signal.pause() # join() won't return until SIG_INT has been captured m.join()