Completed
Push — master ( 3df76a...5af33a )
by Thomas
10:27
created

UnRsvpBw.__init__()   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 2
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
# encoding: utf-8
2
"""
3
nunrsvpbw.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 unpack
10
11
from exabgp.bgp.message.notification import Notify
12
13
from exabgp.bgp.message.update.attribute.bgpls.linkstate import LinkState
14
from exabgp.bgp.message.update.attribute.bgpls.linkstate import BaseLS
15
16
17
#   This sub-TLV contains the amount of bandwidth reservable in this
18
#   direction on this link.  Note that for oversubscription purposes,
19
#   this can be greater than the bandwidth of the link.
20
#    [ One value per priority]
21
#   https://tools.ietf.org/html/rfc5305#section-3.6
22
#
23
#  Units are in Bytes not Bits.
24
#  ----------------------------
25
26
27
@LinkState.register()
28
class UnRsvpBw(BaseLS):
29
    TLV = 1091
30
    REPR = 'Maximum link bandwidth'
31
    JSON = 'unreserved-bandwidth'
32
    LEN = 32
33
34
    @classmethod
35
    def unpack(cls, data, length):
36
        cls.check(length)
37
        return cls(unpack('!ffffffff', data))
38