def __init__(self): # Call init method from LBController super(TEControllerLab1, self).__init__() # Instantiate probability calculator object self.pc = ProbabiliyCalculator() # Create lock for synchronization on accessing self.cg self.capacityGraphLock = threading.Lock() # Set the congestion threshold self.congestionThreshold = congestionThreshold t = time.strftime("%H:%M:%S", time.gmtime()) log.info("%s - Congestion Threshold is set to %.2f%% of the link\n"%(t, (self.congestionThreshold)*100.0)) # Graph that will hold the link available capacities with self.capacityGraphLock: self.cg = self._createCapacitiesGraph() # Variable where we save the last "read-out" copy of the # capacity graph self.cgc = self.cg.copy() # Start the links monitorer thread linked to the event queue lmt = LinksMonitorThread(capacity_graph = self.cg, lock = self.capacityGraphLock, logfile = dconf.LinksMonitor_LogFile, median_filter=False) lmt.start()
def __init__(self, congestionThreshold = 0.8, probabilityAlgorithm='exact'): # Call init method from LBController super(TEControllerLab2, self).__init__(congestionThreshold) # Instantiate probability calculator object self.pc = ProbabiliyCalculator() # Create lock for synchronization on accessing self.cg self.capacityGraphLock = threading.Lock() # Graph that will hold the link available capacities with self.capacityGraphLock: self.cg = self._createCapacitiesGraph() # Variable where we save the last "read-out" copy of the # capacity graph self.cgc = self.cg.copy() # Type of algorithm used to calculate congestion probability # in the ECMP part. It can be: simplified, exact or sampled self.probabilityAlgorithm = probabilityAlgorithm t = time.strftime("%H:%M:%S", time.gmtime()) log.info("%s - ECMP Congestion Probability Calculation function used: %s\n"%(t, self.probabilityAlgorithm)) # Start the links monitorer thread linked to the event queue lmt = LinksMonitorThread(capacity_graph = self.cg, lock = self.capacityGraphLock, logfile = dconf.LinksMonitor_LogFile, median_filter=False) lmt.start()