-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
54c7fa4
commit 7123e9d
Showing
10 changed files
with
223 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Copyright 2015-2018 Cisco Systems, Inc. | ||
# All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
import binascii | ||
|
||
from yabgp.tlv import TLV | ||
from ..linkstate import LinkState | ||
|
||
|
||
# 0 1 2 3 | ||
# 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 | ||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
# | Type | Length | | ||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
# | Flags | Weight | Reserved | | ||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
# | SID/Label/Index (variable) | | ||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
|
||
# 0 1 2 3 4 5 6 7 | ||
# +-+-+-+-+-+-+-+-+ | ||
# |V|L|B|P| | | ||
# +-+-+-+-+-+-+-+-+ | ||
|
||
|
||
@LinkState.register() | ||
class PeerSetSID(TLV): | ||
""" | ||
Peer Set Segment Identifier (Peer-Set-SID) | ||
""" | ||
TYPE = 1103 | ||
TYPE_STR = 'peer_set_sid' | ||
|
||
@classmethod | ||
def unpack(cls, data): | ||
flags = ord(data[0:1]) | ||
flag = {} | ||
flag['V'] = flags >> 7 | ||
flag['L'] = (flags << 1) % 256 >> 7 | ||
flag['B'] = (flags << 2) % 256 >> 7 | ||
flag['P'] = (flags << 3) % 256 >> 7 | ||
weight = ord(data[1:2]) | ||
return cls(value={"flags": flag, "weight": weight, "value": int(binascii.b2a_hex(data[4:]), 16)}) |
33 changes: 33 additions & 0 deletions
33
yabgp/message/attribute/linkstate/link/unidirect_avail_bw.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright 2015-2018 Cisco Systems, Inc. | ||
# All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
import binascii | ||
|
||
from yabgp.tlv import TLV | ||
from ..linkstate import LinkState | ||
|
||
|
||
@LinkState.register(_type=1119) | ||
class UnidirectAvailBw(TLV): | ||
""" | ||
Unidirectional Delay Variation | ||
""" | ||
# TYPE = 1116 # https://tools.ietf.org/html/draft-ietf-idr-te-pm-bgp-10#section-3.6 | ||
TYPE_STR = 'unidirect_avail_bw' | ||
|
||
@classmethod | ||
def unpack(cls, data): | ||
value = int(binascii.b2a_hex(data), 16) | ||
return cls(value=value) |
33 changes: 33 additions & 0 deletions
33
yabgp/message/attribute/linkstate/link/unidirect_bw_util.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright 2015-2018 Cisco Systems, Inc. | ||
# All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
import binascii | ||
|
||
from yabgp.tlv import TLV | ||
from ..linkstate import LinkState | ||
|
||
|
||
@LinkState.register(_type=1120) | ||
class UnidirectBwUtil(TLV): | ||
""" | ||
Unidirectional Delay Variation | ||
""" | ||
# TYPE = 1116 # https://tools.ietf.org/html/draft-ietf-idr-te-pm-bgp-10#section-3.7 | ||
TYPE_STR = 'unidirect_bw_util' | ||
|
||
@classmethod | ||
def unpack(cls, data): | ||
value = int(binascii.b2a_hex(data), 16) | ||
return cls(value=value) |
File renamed without changes.
33 changes: 33 additions & 0 deletions
33
yabgp/message/attribute/linkstate/link/unidirect_packet_loss.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright 2015-2018 Cisco Systems, Inc. | ||
# All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
import binascii | ||
|
||
from yabgp.tlv import TLV | ||
from ..linkstate import LinkState | ||
|
||
|
||
@LinkState.register(_type=1117) | ||
class UnidirectPacketLoss(TLV): | ||
""" | ||
Unidirectional Delay Variation | ||
""" | ||
# TYPE = 1116 # https://tools.ietf.org/html/draft-ietf-idr-te-pm-bgp-10#section-3.4 | ||
TYPE_STR = 'unidirect_packet_loss' | ||
|
||
@classmethod | ||
def unpack(cls, data): | ||
value = int(binascii.b2a_hex(data), 16) | ||
return cls(value=value) |
33 changes: 33 additions & 0 deletions
33
yabgp/message/attribute/linkstate/link/unidirect_residual_bw.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright 2015-2018 Cisco Systems, Inc. | ||
# All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
import binascii | ||
|
||
from yabgp.tlv import TLV | ||
from ..linkstate import LinkState | ||
|
||
|
||
@LinkState.register(_type=1118) | ||
class UnidirectResidualBw(TLV): | ||
""" | ||
Unidirectional Delay Variation | ||
""" | ||
# TYPE = 1116 # https://tools.ietf.org/html/draft-ietf-idr-te-pm-bgp-10#section-3.5 | ||
TYPE_STR = 'unidirect_residual_bw' | ||
|
||
@classmethod | ||
def unpack(cls, data): | ||
value = int(binascii.b2a_hex(data), 16) | ||
return cls(value=value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters