def extended_community(self, scope, name, command, tokens): attributes = scope[-1]['announce'][-1].attributes if Attribute.CODE.EXTENDED_COMMUNITY in attributes: extended_communities = attributes[ Attribute.CODE.EXTENDED_COMMUNITY] else: extended_communities = ExtendedCommunities() attributes.add(extended_communities) extended_community = tokens.pop(0) try: if extended_community == '[': while True: try: extended_community = tokens.pop(0) except IndexError: return self.error.set(self.syntax) if extended_community == ']': break extended_communities.add( self._parse_extended_community(scope, extended_community)) else: extended_communities.add( self._parse_extended_community(scope, extended_community)) except ValueError: return self.error.set(self.syntax) return True
def interface_set(tokeniser): communities = ExtendedCommunities() value = tokeniser() if value == '[': while True: value = tokeniser() if value == ']': break communities.add(_interface_set(value)) else: communities.add(_interface_set(value)) return communities
def extended_community(tokeniser): communities = ExtendedCommunities() value = tokeniser() if value == '[': while True: value = tokeniser() if value == ']': break communities.add(_extended_community(value)) else: communities.add(_extended_community(value)) return communities
def extended_community(tokeniser): communities = ExtendedCommunities() value = tokeniser() if value == "[": while True: value = tokeniser() if value == "]": break communities.add(_extended_community(value)) else: communities.add(_extended_community(value)) return communities
def interface_set (tokeniser): communities = ExtendedCommunities() value = tokeniser() if value == '[': while True: value = tokeniser() if value == ']': break communities.add(_interface_set(value)) else: communities.add(_interface_set(value)) return communities
def extended_community (self, scope, name, command, tokens): attributes = scope[-1]['announce'][-1].attributes if Attribute.CODE.EXTENDED_COMMUNITY in attributes: extended_communities = attributes[Attribute.CODE.EXTENDED_COMMUNITY] else: extended_communities = ExtendedCommunities() attributes.add(extended_communities) extended_community = tokens.pop(0) try: if extended_community == '[': while True: try: extended_community = tokens.pop(0) except IndexError: return self.error.set(self.syntax) if extended_community == ']': break extended_communities.add(self._parse_extended_community(scope,extended_community)) else: extended_communities.add(self._parse_extended_community(scope,extended_community)) except ValueError: return self.error.set(self.syntax) return True