Esempio n. 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]
Esempio n. 2
0
	def _internal (self, announced=True):
		r = INET._internal(self,announced)
		if announced and self.labels:
			r.append(self.labels.json())
		return r
Esempio n. 3
0
	def prefix (self):
		return "%s%s" % (INET.prefix(self),str(self.labels))
Esempio n. 4
0
	def __eq__ (self, other):
		return \
			INET.__eq__(self, other) and \
			self.labels == other.labels
Esempio n. 5
0
	def __len__ (self):
		return INET.__len__(self) + len(self.labels)
Esempio n. 6
0
	def __init__ (self, afi, safi, action):
		INET.__init__(self, afi, safi, action)
		self.labels = Labels.NOLABEL
Esempio n. 7
0
	def __init__ (self, afi, safi, action):
		INET.__init__(self, afi, safi, action)
		self.labels = Labels.NOLABEL