当前位置: 首页>>代码示例>>Python>>正文


Python SAFI.pack方法代码示例

本文整理汇总了Python中exabgp.protocol.family.SAFI.pack方法的典型用法代码示例。如果您正苦于以下问题:Python SAFI.pack方法的具体用法?Python SAFI.pack怎么用?Python SAFI.pack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在exabgp.protocol.family.SAFI的用法示例。


在下文中一共展示了SAFI.pack方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: RouteRefresh

# 需要导入模块: from exabgp.protocol.family import SAFI [as 别名]
# 或者: from exabgp.protocol.family.SAFI import pack [as 别名]
class RouteRefresh (Message):
	ID = Message.ID.ROUTE_REFRESH
	TYPE = chr(Message.ID.ROUTE_REFRESH)

	request = 0
	start = 1
	end = 2

	def __init__ (self,afi,safi,reserved=0):
		self.afi = AFI(afi)
		self.safi = SAFI(safi)
		self.reserved = Reserved(reserved)

	def messages (self,negotitated):
		return [self._message('%s%s%s' % (self.afi.pack(),chr(self.reserved),self.safi.pack())),]

	def __str__ (self):
		return "REFRESH"

	def extensive (self):
		return 'route refresh %s/%d/%s' % (self.afi,self.reserved,self.safi)

	def families (self):
		return self._families[:]

	@classmethod
	def unpack_message (cls,data,negotitated):
		try:
			afi,reserved,safi = unpack('!HBB',data)
		except error:
			raise Notify(7,1,'invalid route-refresh message')
		if reserved not in (0,1,2):
			raise Notify(7,2,'invalid route-refresh message subtype')
		return RouteRefresh(afi,safi,reserved)
开发者ID:Krychuu,项目名称:exabgp,代码行数:36,代码来源:refresh.py

示例2: OperationalFamily

# 需要导入模块: from exabgp.protocol.family import SAFI [as 别名]
# 或者: from exabgp.protocol.family.SAFI import pack [as 别名]
class OperationalFamily (Operational):
	def __init__ (self,what,afi,safi,data=''):
		self.afi = AFI(afi)
		self.safi = SAFI(afi)
		Operational.__init__(
			self,what,
			'%s%s%s' % (self.afi.pack(),self.safi.pack(),data)
		)

	def family (self):
		return (self.afi,self.safi)
开发者ID:ajufrancis,项目名称:exabgp,代码行数:13,代码来源:operational.py

示例3: RouteRefresh

# 需要导入模块: from exabgp.protocol.family import SAFI [as 别名]
# 或者: from exabgp.protocol.family.SAFI import pack [as 别名]
class RouteRefresh (Message):
	ID = Message.CODE.ROUTE_REFRESH
	TYPE = chr(Message.CODE.ROUTE_REFRESH)

	request = 0
	start = 1
	end = 2

	def __init__ (self, afi, safi, reserved=0):
		self.afi = AFI(afi)
		self.safi = SAFI(safi)
		self.reserved = Reserved(reserved)

	def message (self,negotiated=None):
		return self._message('%s%s%s' % (self.afi.pack(),chr(self.reserved),self.safi.pack()))

	def __str__ (self):
		return "REFRESH"

	def extensive (self):
		return 'route refresh %s/%d/%s' % (self.afi,self.reserved,self.safi)

	def families (self):
		return self._families[:]

	@classmethod
	def unpack_message (cls, data, _):
		try:
			afi,reserved,safi = unpack('!HBB',data)
		except error:
			raise Notify(7,1,'invalid route-refresh message')
		if reserved not in (0,1,2):
			raise Notify(7,2,'invalid route-refresh message subtype')
		return RouteRefresh(afi,safi,reserved)

	def __eq__ (self, other):
		if not isinstance(other, RouteRefresh):
			return False
		if self.afi != other.afi:
			return False
		if self.safi != other.safi:
			return False
		if self.reserved != other.reserved:
			return False
		return True

	def __ne__ (self, other):
		return not self.__eq__(other)
开发者ID:CadeLaRen,项目名称:exabgp,代码行数:50,代码来源:refresh.py

示例4: OperationalFamily

# 需要导入模块: from exabgp.protocol.family import SAFI [as 别名]
# 或者: from exabgp.protocol.family.SAFI import pack [as 别名]
class OperationalFamily (Operational):
	has_family = True

	def __init__ (self,what,afi,safi,data=''):
		Operational.__init__(self,what)
		self.afi = AFI(afi)
		self.safi = SAFI(afi)
		self.data = data

	def family (self):
		return (self.afi,self.safi)

	def _message (self,data):
		return Operational._message(self,"%s%s%s" % (
			self.afi.pack(),
			self.safi.pack(),
			data
		))

	def message (self,negotiated):
		return self._message(self.data)
开发者ID:asnd,项目名称:exabgp,代码行数:23,代码来源:operational.py

示例5: RouteRefresh

# 需要导入模块: from exabgp.protocol.family import SAFI [as 别名]
# 或者: from exabgp.protocol.family.SAFI import pack [as 别名]
class RouteRefresh (Message):
	TYPE = chr(Message.Type.ROUTE_REFRESH)

	request = 0
	start = 1
	end = 2

	def __init__ (self,afi,safi,reserved=0):
		self.afi = AFI(afi)
		self.safi = SAFI(safi)
		self.reserved = Reserved(reserved)

	def messages (self,negotitated):
		return [self._message('%s%s%s' % (self.afi.pack(),chr(self.reserved),self.safi.pack())),]

	def __str__ (self):
		return "REFRESH"

	def extensive (self):
		return 'route refresh %s/%d/%s' % (self.afi,self.reserved,self.safi)

	def families (self):
		return self._families[:]
开发者ID:JeevaMunusamy,项目名称:sdx,代码行数:25,代码来源:refresh.py


注:本文中的exabgp.protocol.family.SAFI.pack方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。