import ryu.utils as utils import threading import jsonpickle sys.path.append(os.path.realpath("../simulator")) from ez_lib.cen_ctrl_handler import CenCtrlHandler from ez_lib.ez_topo import Ez_Topo from flow_gen.flow_change_generator import FlowChangeGenerator from domain.message import NotificationMessage from misc import constants, utils, global_vars, logger from time import time from random import Random from topo.topo_factory import TopoFactory logger.init('../logs/cen_result.log', level=logging.INFO) log = logger.getLogger('cen_result', logging.INFO) class SimpleSwitch13(app_manager.RyuApp): OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION] def __init__(self, *args, **kwargs): super(SimpleSwitch13, self).__init__(*args, **kwargs) self.eth_to_port = {} self.logger.info("central_ctrl") self.logger.level = constants.LOG_LEVEL self.datapaths = {} self.topo_input = os.environ.get("TOPO_INPUT", 0)
type=str, default=constants.TOPO_ROCKETFUEL) parser.add_argument('--method', nargs='?', type=str, default=constants.P2P_METHOD) parser.add_argument('--generating_method', nargs='?', type=str, default=constants.LINK_FAILURE_GENERATION) parser.add_argument('--test_number', nargs='?', type=int, default=10) parser.add_argument('--number_of_flows', nargs='?', type=int, default=1000) parser.add_argument('--failure_rate', nargs='?', type=float, default=0.5) args = parser.parse_args() directory = "../%s" % (args.logFolder) if not os.path.exists(directory): os.makedirs(directory) # numeric_level = getattr(logging, args.logLevel.upper(), None) # if not isinstance(numeric_level, int): # raise ValueError('Invalid log level: %s' % numeric_level) # constants.LOG_LEVEL = numeric_level logger.init("../" + args.logFolder + "/" + args.logFile, constants.LOG_LEVEL) log = logger.getLogger("ez-segway", constants.LOG_LEVEL) log.info("---> Log start <---") run_experiment(args, log)