| Total Complexity | 1 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | # encoding: utf-8 |
||
| 2 | """ |
||
| 3 | temetric.py |
||
| 4 | |||
| 5 | Created by Evelio Vila on 2016-12-01. |
||
| 6 | Copyright (c) 2014-2017 Exa Networks. All rights reserved. |
||
| 7 | """ |
||
| 8 | from struct import unpack |
||
| 9 | |||
| 10 | from exabgp.bgp.message.notification import Notify |
||
| 11 | |||
| 12 | from exabgp.bgp.message.update.attribute.bgpls.linkstate import LinkState |
||
| 13 | from exabgp.bgp.message.update.attribute.bgpls.linkstate import BaseLS |
||
| 14 | |||
| 15 | |||
| 16 | # 0 1 2 3 |
||
| 17 | # 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 |
||
| 18 | # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
||
| 19 | # | Type | Length | |
||
| 20 | # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
||
| 21 | # | TE Default Link Metric | |
||
| 22 | # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
||
| 23 | # https://tools.ietf.org/html/rfc7752#section-3.3.2.3 TE Metric |
||
| 24 | |||
| 25 | |||
| 26 | @LinkState.register() |
||
| 27 | class TeMetric(BaseLS): |
||
| 28 | TLV = 1092 |
||
| 29 | REPR = 'TE Default Metric' |
||
| 30 | JSON = 'te-metric' |
||
| 31 | LEN = 4 |
||
| 32 | |||
| 33 | @classmethod |
||
| 34 | def unpack(cls, data, length): |
||
| 35 | cls.check(length) |
||
| 36 | return cls(unpack('!L', data)[0]) |
||
| 37 |