Example #1
0
def ip_multicast (tokeniser,afi,safi):
	ipmask = prefix(tokeniser)

	nlri = INET(afi,safi,OUT.ANNOUNCE)
	nlri.cidr = CIDR(ipmask.pack(),ipmask.mask)

	change = Change(
		nlri,
		Attributes()
	)

	while True:
		command = tokeniser()

		if not command:
			break

		action = AnnounceIP.action.get(command,'')

		if action == 'attribute-add':
			change.attributes.add(AnnounceIP.known[command](tokeniser))
		elif action == 'nlri-set':
			change.nlri.assign(AnnounceIP.assign[command],AnnounceIP.known[command](tokeniser))
		elif action == 'nexthop-and-attribute':
			nexthop,attribute = AnnounceIP.known[command](tokeniser)
			change.nlri.nexthop = nexthop
			change.attributes.add(attribute)
		else:
			raise ValueError('route: unknown command "%s"' % command)

	return [change]
Example #2
0
	def _internal (self, announced=True):
		r = INET._internal(self,announced)
		if announced and self.labels:
			r.append(self.labels.json())
		return r
Example #3
0
	def prefix (self):
		return "%s%s" % (INET.prefix(self),str(self.labels))
Example #4
0
	def __eq__ (self, other):
		return \
			INET.__eq__(self, other) and \
			self.labels == other.labels
Example #5
0
	def __len__ (self):
		return INET.__len__(self) + len(self.labels)
Example #6
0
	def __init__ (self, afi, safi, action):
		INET.__init__(self, afi, safi, action)
		self.labels = Labels.NOLABEL
Example #7
0
	def __init__ (self, afi, safi, action):
		INET.__init__(self, afi, safi, action)
		self.labels = Labels.NOLABEL