コード例 #1
0
ファイル: __init__.py プロジェクト: Krychuu/exabgp
class RIB (object):

	# when we perform a configuration reload using SIGUSR, we must not use the RIB
	# without the cache, all the updates previously sent via the API are lost

	_cache = {}

	def __init__ (self,name,adjribout,families):
		if name in self._cache:
			self.incoming = self._cache[name].incoming
			self.outgoing = self._cache[name].outgoing
			if adjribout:
				self.outgoing.resend(None,False)
			else:
				self.outgoing.clear()
		else:
			self.incoming = Store(families)
			self.outgoing = Store(families)
			self._cache[name] = self

		self.outgoing.cache = adjribout

	def reset (self):
		self.incoming.reset()
		self.outgoing.reset()
コード例 #2
0
ファイル: __init__.py プロジェクト: wicaksana/sdx-pyretic
class RIB:

    # when we perform a configuration reload using SIGUSR, we must not use the RIB
    # without the cache, all the updates previously sent via the API are lost

    _cache = {}

    def __init__(self, name, adjribout, families):
        if name in self._cache:
            self.incoming = self._cache[name].incoming
            self.outgoing = self._cache[name].outgoing
            if adjribout:
                self.outgoing.resend(None, False)
            else:
                self.outgoing.clear()
        else:
            self.incoming = Store(families)
            self.outgoing = Store(families)
            self._cache[name] = self

        self.outgoing.cache = adjribout

    def reset(self):
        self.incoming.reset()
        self.outgoing.reset()
コード例 #3
0
ファイル: __init__.py プロジェクト: rnts08/exabgp
class RIB:
	def __init__ (self,name,families,new=False):
		self.incoming = Store(False,families)
		self.outgoing = Store(True,families)

	def reset (self):
		self.incoming.reset()
		self.outgoing.reset()

	def resend (self,send_families,enhanced_refresh):
		self.outgoing.resend(send_families,enhanced_refresh)
コード例 #4
0
ファイル: __init__.py プロジェクト: leleobhz/exabgp
class RIB(object):

    # when we perform a configuration reload using SIGUSR, we must not use the RIB
    # without the cache, all the updates previously sent via the API are lost

    _cache = {}

    def __init__(self, name, adjribout, families):
        self.name = name

        if name in self._cache:
            self.incoming = self._cache[name].incoming
            self.outgoing = self._cache[name].outgoing
            self.incoming.families = families
            self.outgoing.families = families
            for family in self.outgoing._seen.keys():
                if family not in families:
                    del self.outgoing._seen[family]

            if adjribout:
                self.outgoing.resend(None, False)
            else:
                self.outgoing.clear()
        else:
            self.incoming = Store(families)
            self.outgoing = Store(families)
            self._cache[name] = self

        self.outgoing.cache = adjribout

    def reset(self):
        self.incoming.reset()
        self.outgoing.reset()

    def uncache(self):
        if self.name in self._cache:
            del self._cache[self.name]

    # This code was never tested ...
    def clear(self):
        self._cache[self.name].incoming = Store(
            self._cache[self.name].incoming.families)
        self._cache[self.name].outgoing = Store(
            self._cache[self.name].incoming.families)
コード例 #5
0
ファイル: __init__.py プロジェクト: Exa-Networks/exabgp
class RIB(object):

    # when we perform a configuration reload using SIGUSR, we must not use the RIB
    # without the cache, all the updates previously sent via the API are lost

    _cache = {}

    def __init__(self, name, adjribout, families):
        self.name = name

        if name in self._cache:
            self.incoming = self._cache[name].incoming
            self.outgoing = self._cache[name].outgoing
            self.incoming.families = families
            self.outgoing.families = families
            for family in self.outgoing._seen.keys():
                if family not in families:
                    del self.outgoing._seen[family]

            if adjribout:
                self.outgoing.resend(None, False)
            else:
                self.outgoing.clear()
        else:
            self.incoming = Store(families)
            self.outgoing = Store(families)
            self._cache[name] = self

        self.outgoing.cache = adjribout

    def reset(self):
        self.incoming.reset()
        self.outgoing.reset()

        # This code was never tested ...

    def clear(self):
        self._cache[self.name].incoming = Store(self._cache[self.name].incoming.families)
        self._cache[self.name].outgoing = Store(self._cache[self.name].incoming.families)