OXIESEC PANEL
- Current Dir:
/
/
opt
/
alt
/
python37
/
lib
/
python3.7
/
site-packages
/
exabgp
/
bgp
/
message
/
open
/
capability
Server IP: 2a02:4780:11:1084:0:327f:3464:10
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
03/16/2023 12:55:54 PM
rwxr-xr-x
📄
__init__.py
1.29 KB
03/13/2021 04:30:48 PM
rw-r--r--
📁
__pycache__
-
03/16/2023 12:55:54 PM
rwxr-xr-x
📄
addpath.py
2.13 KB
03/13/2021 04:30:48 PM
rw-r--r--
📄
asn4.py
966 bytes
03/13/2021 04:30:48 PM
rw-r--r--
📄
capabilities.py
7.16 KB
03/13/2021 04:30:48 PM
rw-r--r--
📄
capability.py
6.89 KB
03/13/2021 04:30:48 PM
rw-r--r--
📄
extended.py
899 bytes
03/13/2021 04:30:48 PM
rw-r--r--
📄
graceful.py
3.2 KB
03/13/2021 04:30:48 PM
rw-r--r--
📄
hostname.py
1.33 KB
03/13/2021 04:30:48 PM
rw-r--r--
📄
mp.py
1.27 KB
03/13/2021 04:30:48 PM
rw-r--r--
📄
ms.py
1.47 KB
03/13/2021 04:30:48 PM
rw-r--r--
📄
negotiated.py
8.81 KB
03/13/2021 04:30:48 PM
rw-r--r--
📄
nexthop.py
1.81 KB
03/13/2021 04:30:48 PM
rw-r--r--
📄
operational.py
932 bytes
03/13/2021 04:30:48 PM
rw-r--r--
📄
refresh.py
2.63 KB
03/13/2021 04:30:48 PM
rw-r--r--
📄
unknown.py
1.4 KB
03/13/2021 04:30:48 PM
rw-r--r--
Editing: nexthop.py
Close
# encoding: utf-8 """ nexthop.py Created by Thomas Mangin on 2019-05-23. Copyright (c) 2009-2017 Exa Networks. All rights reserved. License: 3-clause BSD. (See the COPYRIGHT file) """ from struct import pack from exabgp.protocol.family import AFI from exabgp.protocol.family import SAFI from exabgp.bgp.message.open.capability.capability import Capability # ================================================================ NextHop # @Capability.register() class NextHop(Capability, list): ID = Capability.CODE.NEXTHOP def __init__(self, data=[]): for afi, safi, nhafi in data: self.add_nexthop(afi, safi, nhafi) def add_nexthop(self, afi, safi, nhafi): if (afi, safi, nhafi) not in self: self.append((afi, safi, nhafi)) def __str__(self): return ( 'NextHop(' + ','.join(["%s %s %s" % (str(afi), str(safi), str(nhafi)) for (afi, safi, nhafi) in self]) + ')' ) def json(self): return '{ "name": "nexthop", "conversion": [%s ] }' % ','.join( [' "%s/%s/%s"' % (str(afi), str(safi), str(nhafi)) for (afi, safi, nhafi) in self] ) def extract(self): rs = b'' for afi, safi, nhafi in self: rs += afi.pack() + pack("!B", 0) + safi.pack() + nhafi.pack() return [ rs, ] @staticmethod def unpack_capability(instance, data, capability=None): # pylint: disable=W0613 # XXX: FIXME: we should complain if we have twice the same AFI/SAFI # XXX: FIXME: should check that we have not yet seen the capability while data: afi = AFI.unpack(data[:2]) safi = SAFI.unpack(data[3]) nexthop = AFI.unpack(data[4:6]) instance.add_nexthop(afi, safi, nexthop) data = data[6:] return instance