def __init__(self, hostname, interfaces, mean_arrv_time, mean_pkt_size): arrv_time_distribution = functools.partial(random.expovariate, 1.0/float(mean_arrv_time)) pkt_size_distribution = functools.partial(random.expovariate, 1.0/float(mean_pkt_size)) PacketGenerator.__init__(self,GlobalConfiguration.simpyEnv, hostname, arrv_time_distribution, pkt_size_distribution) self.hostname = hostname self.interfaces = interfaces
def __init__(self, bandwidth, hostname): mean_arrv_rate = GlobalConfiguration.mean_arrv_rate mean_pkt_size = GlobalConfiguration.mean_pkt_size arrv_time_distribution = functools.partial(random.expovariate, mean_arrv_rate) pkt_size_distribution = functools.partial(random.expovariate, 1.0/float(mean_pkt_size)) PacketGenerator.__init__(self, GlobalConfiguration.simpyEnv, hostname, arrv_time_distribution, pkt_size_distribution, rate = float(bandwidth)) self.hostname = hostname