def __init__(self, bgpManager, labelAllocator, dataplaneDriver, externalInstanceId, instanceId, importRTs, exportRTs, gatewayIP, mask, readvertise, **kwargs): self.instanceType = self.__class__.__name__ self.instanceId = instanceId Thread.__init__(self) self.setDaemon(True) if dataplaneDriver.ecmpSupport: compareRoutes = compareECMP else: compareRoutes = compareNoECMP TrackerWorker.__init__(self, bgpManager, "%s %d" % (self.instanceType, self.instanceId), compareRoutes) LookingGlassLocalLogger.__init__( self, "%s-%d" % (self.instanceType, self.instanceId)) self.lock = Lock() self.importRTs = importRTs self.exportRTs = exportRTs self.externalInstanceId = externalInstanceId self.gatewayIP = gatewayIP self.mask = mask self.afi = self.__class__.afi self.safi = self.__class__.safi assert (isinstance(self.afi, AFI)) assert (isinstance(self.safi, SAFI)) self.dataplaneDriver = dataplaneDriver self.labelAllocator = labelAllocator self.instanceLabel = self.labelAllocator.getNewLabel( "Incoming traffic for %s %d" % (self.instanceType, self.instanceId)) self.localPortData = dict() # One local port -> List of endpoints (MAC and IP addresses tuple) self.localPort2Endpoints = dict() # One MAC address -> One local port self.macAddress2LocalPortData = dict() # One IP address -> One MAC address self.ipAddress2MacAddress = dict() self.dataplane = self.dataplaneDriver.initializeDataplaneInstance( self.instanceId, self.externalInstanceId, self.gatewayIP, self.mask, self.instanceLabel, **kwargs) for rt in self.importRTs: self._subscribe(self.afi, self.safi, rt) if readvertise: self.readvertise = True try: self.readvertiseToRTs = readvertise['to_rt'] except KeyError: raise APIException("'readvertise' specified with no 'to_rt'") self.readvertiseFromRTs = readvertise.get('from_rt', []) self.log.debug("readvertise enabled, from RT:%s, to %s", self.readvertiseFromRTs, self.readvertiseToRTs) for rt in self.readvertiseFromRTs: self._subscribe(self.afi, self.safi, rt) else: self.log.debug("readvertise not enabled") self.readvertise = False
def __init__(self, bgpManager, labelAllocator, vnid, dataplaneDriver, externalInstanceId, instanceId, importRTs, exportRTs, gatewayIP, mask, readvertise, **kwargs): self.instanceType = self.__class__.__name__ self.instanceId = instanceId Thread.__init__(self) self.setDaemon(True) if dataplaneDriver.ecmpSupport: compareRoutes = compareECMP else: compareRoutes = compareNoECMP TrackerWorker.__init__(self, bgpManager, "%s %d" % (self.instanceType, self.instanceId), compareRoutes) LookingGlassLocalLogger.__init__(self, "%s-%d" % (self.instanceType, self.instanceId)) self.lock = Lock() self.importRTs = importRTs self.exportRTs = exportRTs self.externalInstanceId = externalInstanceId self.gatewayIP = gatewayIP self.mask = mask self.vnid = vnid self.afi = self.__class__.afi self.safi = self.__class__.safi assert(isinstance(self.afi, AFI)) assert(isinstance(self.safi, SAFI)) self.dataplaneDriver = dataplaneDriver if vnid is None: self.labelAllocator = labelAllocator self.instanceLabel = self.labelAllocator.getNewLabel( "Incoming traffic for %s %d" % (self.instanceType, self.instanceId)) else: self.instanceLabel = int(vnid) self.localPortData = dict() # One local port -> List of endpoints (MAC and IP addresses tuple) self.localPort2Endpoints = dict() # One MAC address -> One local port self.macAddress2LocalPortData = dict() # One IP address -> One MAC address self.ipAddress2MacAddress = dict() self.dataplane = self.dataplaneDriver.initializeDataplaneInstance( self.instanceId, self.externalInstanceId, self.gatewayIP, self.mask, self.instanceLabel, **kwargs) for rt in self.importRTs: self._subscribe(self.afi, self.safi, rt) if readvertise: self.readvertise = True try: self.readvertiseToRTs = readvertise['to_rt'] except KeyError: raise APIException("'readvertise' specified with no 'to_rt'") self.readvertiseFromRTs = readvertise.get('from_rt', []) self.log.debug("readvertise enabled, from RT:%s, to %s", self.readvertiseFromRTs, self.readvertiseToRTs) for rt in self.readvertiseFromRTs: self._subscribe(self.afi, self.safi, rt) else: self.log.debug("readvertise not enabled") self.readvertise = False
def __init__(self): Thread.__init__(self, name="TrackerWorkerThread") self.setDaemon(True) TrackerWorker.__init__(self, "BGPManager", "TrackerWorker", _test_compareRoutes)
def __init__(self): Thread.__init__(self, name='TrackerWorkerThread') self.setDaemon(True) TrackerWorker.__init__( self, 'BGPManager', 'TrackerWorker', _test_compareRoutes)