Completed
Push — master ( 229cac...232edf )
by Thomas
10:56
created

exabgp.bgp.message.update.attribute.bgpls.link.protection.LinkProtectionType.unpack()   A

Complexity

Conditions 2

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 6
nop 3
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
# encoding: utf-8
2
"""
3
protection.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 exabgp.bgp.message.notification import Notify
10
from exabgp.bgp.message.update.attribute.bgpls.linkstate import LINKSTATE
11
from exabgp.bgp.message.update.attribute.bgpls.linkstate import LsGenericFlags
12
13
#       0                   1
14
#       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
15
#      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
16
#      |Protection Cap |    Reserved   |
17
#      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
18
#      https://tools.ietf.org/html/rfc5307 Sec 1.2
19
#      0x01  Extra Traffic
20
#      0x02  Unprotected
21
#      0x04  Shared
22
#      0x08  Dedicated 1:1
23
#      0x10  Dedicated 1+1
24
#      0x20  Enhanced
25
#      0x40  Reserved
26
#      0x80  Reserved
27
28
29
@LINKSTATE.register()
30
class LinkProtectionType(LsGenericFlags):
31
    REPR = 'Link protection mask'
32
    JSON = 'link-protection-flags'
33
    TLV = 1093
34
    FLAGS = [
35
        'ExtraTrafic',
36
        'Unprotected',
37
        'Shared',
38
        'Dedicated 1:1',
39
        'Dedicated 1+1',
40
        'Enhanced',
41
        'RSV',
42
        'RSV',
43
    ]
44
    LEN = 2
45