Esempio n. 1
0
    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
Esempio n. 2
0
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
Esempio n. 3
0
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
Esempio n. 4
0
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
Esempio n. 5
0
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
Esempio n. 6
0
	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