Total Complexity | 1 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | # encoding: utf-8 |
||
2 | """ |
||
3 | nodename.py |
||
4 | |||
5 | Created by Evelio Vila on 2016-12-01. |
||
6 | Copyright (c) 2014-2017 Exa Networks. All rights reserved. |
||
7 | """ |
||
8 | |||
9 | from struct import pack |
||
10 | from struct import unpack |
||
11 | |||
12 | from exabgp.bgp.message.notification import Notify |
||
13 | |||
14 | from exabgp.bgp.message.update.attribute.bgpls.linkstate import LinkState |
||
15 | from exabgp.bgp.message.update.attribute.bgpls.linkstate import BaseLS |
||
16 | |||
17 | # |
||
18 | # 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
||
19 | # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
||
20 | # | Type | Length | |
||
21 | # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
||
22 | # // Opaque Prefix Attributes (variable) // |
||
23 | # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
||
24 | # https://tools.ietf.org/html/rfc7752#section-3.3.3.6 |
||
25 | # |
||
26 | |||
27 | |||
28 | @LinkState.register() |
||
29 | class PrefixOpaque(BaseLS): |
||
30 | TLV = 1157 |
||
31 | REPR = 'Opaque Prefix Attribute' |
||
32 | JSON = 'opaque-prefix' |
||
33 | |||
34 | @classmethod |
||
35 | def unpack(cls, data, length): |
||
36 | return cls(unpack("!%ds" % length, data[:length])[0]) |
||
37 |