Beispiel #1
0
    def unpack_nlri(cls, afi, safi, bgp, action, addpath):

        length = bgp[0]

        if length == 0:
            return cls(afi, safi, action, ASN(0), None), bgp[1:]

        if length < 8 * 4:
            raise Exception("incorrect RT length: %d (should be >=32,<=96)" %
                            length)

        # We are reseting the flags on the RouteTarget extended
        # community, because they do not make sense for an RTC route

        return (
            cls(
                afi,
                safi,
                action,
                ASN(unpack('!L', bgp[1:5])[0]),
                RouteTarget.unpack(
                    bytes([RTC.resetFlags(bgp[5])]) + bgp[6:13]),
            ),
            bgp[13:],
        )
Beispiel #2
0
    def unpack(cls, afi, safi, data, addpath, nexthop, action):
        length = ord(data[0])

        if length == 0:
            return 1, cls(afi, safi, action, NoNextHop, ASN(0), None)

        # We are reseting the flags on the RouteTarget extended
        # community, because they do not make sense for an RTC route

        return 13, cls(
            afi, safi, action, nexthop, ASN(unpack('!L', data[1:5])[0]),
            RouteTarget.unpack(RTC.resetFlags(data[5]) + data[6:13]))
Beispiel #3
0
    def unpack_nlri(cls, afi, safi, bgp, action, addpath):

        length = ord(bgp[0])

        if length == 0:
            return 1, cls(afi, safi, action, ASN(0), None)

        # We are reseting the flags on the RouteTarget extended
        # community, because they do not make sense for an RTC route

        return cls(afi, safi, action, ASN(unpack('!L', bgp[1:5])[0]),
                   RouteTarget.unpack(RTC.resetFlags(bgp[5]) +
                                      bgp[6:13])), bgp[13:]
Beispiel #4
0
	def unpack (cls, afi, safi, data, addpath, nexthop, action):
		length = ord(data[0])

		if length == 0:
			return 1,cls(afi,safi,action,NoNextHop,ASN(0),None)

		# XXX: Why are we reseting the flags on the RouteTarget extended community ?

		return 13,cls(
			afi, safi, action, nexthop,
			ASN(unpack('!L', data[1:5])[0]),
			RouteTarget.unpack(
				RTC.resetFlags(data[5])+data[6:13]
			)
		)
Beispiel #5
0
	def unpack (cls, afi, safi, data, addpath, nexthop, action):
		length = ord(data[0])

		if length == 0:
			return 1,cls(afi,safi,action,NoNextHop,ASN(0),None)

		# We are reseting the flags on the RouteTarget extended
		# community, because they do not make sense for an RTC route

		return 13,cls(
			afi, safi, action, nexthop,
			ASN(unpack('!L', data[1:5])[0]),
			RouteTarget.unpack(
				RTC.resetFlags(data[5])+data[6:13]
			)
		)
Beispiel #6
0
	def unpack_nlri (cls, afi, safi, bgp, action, addpath):

		length = ord(bgp[0])

		if length == 0:
			return 1,cls(afi,safi,action,ASN(0),None)

		# We are reseting the flags on the RouteTarget extended
		# community, because they do not make sense for an RTC route

		return cls(
			afi, safi, action,
			ASN(unpack('!L', bgp[1:5])[0]),
			RouteTarget.unpack(
				RTC.resetFlags(bgp[5])+bgp[6:13]
			)
		),bgp[13:]
Beispiel #7
0
	def unpack_nlri (cls, afi, safi, bgp, action, addpath):

		length = ord(bgp[0])

		if length == 0:
			return cls(afi,safi,action,ASN(0),None),bgp[1:]

		if length < 8*4:
			raise Exception("incorrect RT lenght: %d (should be >=32,<=96)" % length)

		# We are reseting the flags on the RouteTarget extended
		# community, because they do not make sense for an RTC route

		return cls(
			afi, safi, action,
			ASN(unpack('!L', bgp[1:5])[0]),
			RouteTarget.unpack(
				RTC.resetFlags(bgp[5])+bgp[6:13]
			)
		),bgp[13:]