| Total Complexity | 2 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | # encoding: utf-8 |
||
| 2 | """ |
||
| 3 | ospfaddr.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.protocol.ip import IP |
||
| 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 | # 0 1 2 3 |
||
| 16 | # 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 |
||
| 17 | # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
||
| 18 | # | Type | Length | |
||
| 19 | # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
||
| 20 | # // Forwarding Address (variable) // |
||
| 21 | # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
||
| 22 | # https://tools.ietf.org/html/rfc7752#section-3.3.3.5 |
||
| 23 | |||
| 24 | |||
| 25 | @LinkState.register() |
||
| 26 | class OspfForwardingAddress(BaseLS): |
||
| 27 | TLV = 1156 |
||
| 28 | REPR = 'Ospf forwarding address' |
||
| 29 | JSON = 'ospf-forwarding-address' |
||
| 30 | |||
| 31 | @classmethod |
||
| 32 | def unpack(cls, data, length): |
||
| 33 | size = len(data) |
||
| 34 | if size not in (4, 16): |
||
| 35 | raise Notify(3, 5, "Error parsing OSPF Forwarding Address. Wrong size") |
||
| 36 | return cls(IP.unpack(data[:size])) |
||
| 37 |