| Total Complexity | 1 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | # encoding: utf-8 |
||
| 2 | """ |
||
| 3 | prefixmetric.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 | # 0 1 2 3 |
||
| 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 | # | Metric | |
||
| 23 | # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
||
| 24 | # https://tools.ietf.org/html/rfc7752#section-3.3.3.4 |
||
| 25 | |||
| 26 | |||
| 27 | @LinkState.register() |
||
| 28 | class PrefixMetric(BaseLS): |
||
| 29 | TLV = 1155 |
||
| 30 | REPR = 'prefix_metric' |
||
| 31 | JSON = 'prefix-metric' |
||
| 32 | LEN = 4 |
||
| 33 | |||
| 34 | @classmethod |
||
| 35 | def unpack(cls, data, length): |
||
| 36 | cls.check(length) |
||
| 37 | return cls(int(unpack("!L", data)[0])) |
||
| 38 |