| Total Complexity | 1 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | # encoding: utf-8 |
||
| 2 | """ |
||
| 3 | maxbw.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 | from exabgp.bgp.message.update.attribute.bgpls.linkstate import LinkState |
||
| 13 | from exabgp.bgp.message.update.attribute.bgpls.linkstate import BaseLS |
||
| 14 | |||
| 15 | # This sub-TLV contains the maximum bandwidth that can be used on this |
||
| 16 | # link in this direction (from the system originating the LSP to its |
||
| 17 | # neighbors). |
||
| 18 | # https://tools.ietf.org/html/rfc5305#section-3.4 |
||
| 19 | # |
||
| 20 | # Units are in Bytes not Bits. |
||
| 21 | # ---------------------------- |
||
| 22 | |||
| 23 | |||
| 24 | @LinkState.register() |
||
| 25 | class MaxBw(BaseLS): |
||
| 26 | TLV = 1089 |
||
| 27 | REPR = 'Maximum link bandwidth' |
||
| 28 | JSON = 'maximum-link-bandwidth' |
||
| 29 | LEN = 4 |
||
| 30 | |||
| 31 | @classmethod |
||
| 32 | def unpack(cls, data, length): |
||
| 33 | cls.check(length) |
||
| 34 | return cls(unpack('!f', data)[0]) |
||
| 35 |