-
Notifications
You must be signed in to change notification settings - Fork 69
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
f2c52ba
commit 034eeee
Showing
3 changed files
with
102 additions
and
3 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
63 changes: 63 additions & 0 deletions
63
yabgp/tests/unit/message/attribute/nlri/test_linkstate_prefix_sid.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,63 @@ | ||
# Copyright 2015-2017 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. | ||
|
||
""" Test Link State attribute""" | ||
|
||
import unittest | ||
from yabgp.message.attribute.linkstate.linkstate import LinkState | ||
|
||
|
||
class TestLinkStatePrefixSID(unittest.TestCase): | ||
|
||
def test_prefix_sid_flags_ospf(self): | ||
self.maxDiff = None | ||
data_bin = b'\x04\x86\x00\x07\xb4\x00\x00\x00\x00\x61\xa9' | ||
|
||
data_dict = {29: [{ | ||
'type': 'prefix_sid', | ||
'value': { | ||
'sid': 25001, | ||
'flags': { | ||
'NP': 0, | ||
'M': 1, | ||
'E': 1, | ||
'V': 0, | ||
'L': 1 | ||
}, | ||
'algorithm': 0 | ||
} | ||
}]} | ||
self.assertEqual(data_dict, LinkState.unpack(data_bin, 3).dict()) | ||
|
||
def test_prefix_id_flags_isis(self): | ||
self.maxDiff = None | ||
data_bin = b'\x04\x86\x00\x07\xb4\x00\x00\x00\x00\x61\xa9' | ||
|
||
data_dict = {29: [{ | ||
'type': 'prefix_sid', | ||
'value': { | ||
'sid': 25001, | ||
'flags': { | ||
'R': 1, | ||
'N': 0, | ||
'P': 1, | ||
'E': 1, | ||
'V': 0, | ||
'L': 1 | ||
}, | ||
'algorithm': 0 | ||
} | ||
}]} | ||
self.assertEqual(data_dict, LinkState.unpack(data_bin, 1).dict()) |