"514": "00000000", // Area 0
"515": "0a0a0a0a" // router-id: 10.10.10.10
}
- },
- "attr": // Attributes to test display
- {
- "1152": "80", // IGP flags
- "1097": "000b00020123000500020123", //opaque Link TLV
- "1105": "d123ed", // RTM capabilities
- "1172": "dc12fceb04400004000f0001", // L2 bundle member attributes
- "1117": "00FFFFFF", //Packet Loss 50.331642%
- "1039": "820000800411000400000001041500040000000a0413000480000000", //flex-algo definition
- "1044": "82800000000003e8", // flex-algo prefix metric
- "1121": "", // graceful link shutdown
- "1171": "00120012000000000000000000120012", // source router IPv6
- "1871": "00120012000000000000000000" // Unknown TLV
}
},
{
+++ /dev/null
-{
- "Node OSPFv2 ID:0x20 {Local {AS:65001 ID:0 Area:0 Rtr:10.10.10.10}}/XX": {
- "1152": {
- "description": "IGP Flags",
- "type": 1152,
- "length": 1,
- "data": "0b10000000"
- },
- "1097": {
- "description": "Opaque Link Attribute",
- "type": 1097,
- "length": 12,
- "data": {
- "11": {
- "type": 11,
- "length": 2,
- "data": "0x0123"
- },
- "5": {
- "type": 5,
- "length": 2,
- "data": "0x0123"
- }
- }
- },
- "1105": {
- "description": "RTM Capability",
- "type": 1105,
- "length": 3,
- "data": {
- "flags": "0b110",
- "values": "0x11ed"
- }
- },
- "1172": {
- "description": "L2 Bundle Member Attributes",
- "type": 1172,
- "length": 12,
- "data": {
- "descriptor": "0xdc12fceb",
- "1088": {
- "description": "Administrative group",
- "type": 1088,
- "length": 4,
- "data": "0x000f0001"
- }
- }
- },
- "1117": {
- "description": "Unidirectional Link Loss",
- "type": 1117,
- "length": 4,
- "data": {
- "anomalous": false,
- "lossPercent": 50.33164596557617
- }
- },
- "1039": {
- "description": "Flexible Algorithm Definition",
- "type": 1039,
- "length": 28,
- "data": {
- "flexAlgo": 130,
- "metricType": 0,
- "calcType": 0,
- "priority": 128,
- "1041": {
- "description": "Flexible Algorithm Include Any Affinity",
- "type": 1041,
- "length": 4,
- "data": "0x00000001"
- },
- "1045": {
- "description": "Flexible Algorithm Exclude SRLG",
- "type": 1045,
- "length": 4,
- "data": [
- 10
- ]
- },
- "1043": {
- "description": "Flexible Algorithm Definition Flags",
- "type": 1043,
- "length": 4,
- "data": "0b10000000 00000000 00000000 00000000"
- }
- }
- },
- "1044": {
- "description": "Flexible Algorithm Prefix Metric",
- "type": 1044,
- "length": 8,
- "data": {
- "flexAlgo": 130,
- "flags": "0b10000000",
- "metric": 1000
- }
- },
- "1121": {
- "description": "Graceful-Link-Shutdown TLV",
- "type": 1121,
- "length": 0
- },
- "1171": {
- "description": "Source Router Identifier",
- "type": 1171,
- "length": 16,
- "data": "12:12::12:12"
- },
- "1871": {
- "type": 1871,
- "length": 13,
- "data": "0x00120012000000000000000000"
- }
- },
- "Node ISIS-L1 ID:0x20 {Local {AS:65001 ID:0 Rtr:0000.0000.1003.00}}/XX": {
- "263": {
- "description": "Multi-Topology ID",
- "type": 263,
- "length": 4,
- "data": [
- 0,
- 2
- ]
- },
- "266": {
- "description": "Node MSD",
- "type": 266,
- "length": 2,
- "data": [
- {
- "type": 1,
- "value": 8
- }
- ]
- },
- "1026": {
- "description": "Node Name",
- "type": 1026,
- "length": 2,
- "data": "r3"
- },
- "1027": {
- "description": "IS-IS Area Identifier",
- "type": 1027,
- "length": 3,
- "data": "49.1000"
- },
- "1028": {
- "description": "IPv4 Router-ID of Local Node",
- "type": 1028,
- "length": 4,
- "data": "3.3.3.3"
- },
- "1034": {
- "description": "SR Capabilities",
- "type": 1034,
- "length": 12,
- "data": {
- "flags": "0b11000000",
- "range": 4000,
- "1161": {
- "description": "SID/Label",
- "type": 1161,
- "length": 3,
- "data": {
- "fromLabel": 20000
- }
- }
- }
- },
- "1035": {
- "description": "SR Algorithm",
- "type": 1035,
- "length": 3,
- "data": [
- 0,
- 128,
- 130
- ]
- },
- "1036": {
- "description": "SR Local Block",
- "type": 1036,
- "length": 12,
- "data": {
- "flags": "0b00000000",
- "range": 1000,
- "1161": {
- "description": "SID/Label",
- "type": 1161,
- "length": 3,
- "data": {
- "fromLabel": 15000
- }
- }
- }
- }
- },
- "Link ISIS-L1 ID:0x20 {Local {AS:65001 ID:0 Rtr:0000.0000.1001} Remote {AS:65001 ID:0 Rtr:0000.0000.1000} IPv4:10.1.0.1 Neigh-IPv4:10.1.0.2 IPv6:2001::1 Neigh-IPv6:2001::2 MT:0,2}/XX": {
- "1028": {
- "description": "IPv4 Router-ID of Local Node",
- "type": 1028,
- "length": 4,
- "data": "1.1.1.1"
- },
- "1030": {
- "description": "IPv4 Router-ID of Remote Node",
- "type": 1030,
- "length": 4,
- "data": "10.10.10.10"
- },
- "1089": {
- "description": "Maximum link bandwidth",
- "type": 1089,
- "length": 4,
- "data": 176258176,
- "dataUnit": "bps"
- },
- "1090": {
- "description": "Max. reservable link bandwidth",
- "type": 1090,
- "length": 4,
- "data": 176258176,
- "dataUnit": "bps"
- },
- "1091": {
- "description": "Unreserved bandwidth",
- "type": 1091,
- "length": 32,
- "dataUnit": "bps",
- "data": {
- "0": 176258176,
- "1": 176258176,
- "2": 176258176,
- "3": 176258176,
- "4": 176258176,
- "5": 176258176,
- "6": 176258176,
- "7": 176258176
- }
- },
- "1092": {
- "description": "TE Default Metric",
- "type": 1092,
- "length": 4,
- "data": 100
- },
- "1095": {
- "description": "IGP Metric",
- "type": 1095,
- "length": 3,
- "data": 10
- },
- "1099": {
- "description": "Adjacency SID",
- "type": 1099,
- "length": 7,
- "data": {
- "flags": "0b00110000",
- "weight": 0,
- "sid": 15000
- }
- },
- "1114": {
- "description": "Unidirectional Link Delay",
- "type": 1114,
- "length": 4,
- "data": {
- "anomalous": false,
- "delay": 8500
- },
- "dataUnit": "microseconds"
- },
- "1115": {
- "description": "Min/Max Unidirectional Link Delay",
- "type": 1115,
- "length": 8,
- "data": {
- "anomalous": false,
- "minDelay": 8000,
- "maxDelay": 9000
- },
- "dataUnit": "microseconds"
- },
- "1122": {
- "description": "Application-Specific Link Attributes",
- "type": 1122,
- "length": 48,
- "data": {
- "sabmFlags": "0b00010000 00000000 00000000 00000000",
- "udabmFlags": "0b00000000 00000000 00000000 00000000",
- "1088": {
- "description": "Administrative group",
- "type": 1088,
- "length": 4,
- "data": "0x00000001"
- },
- "1092": {
- "description": "TE Default Metric",
- "type": 1092,
- "length": 4,
- "data": 100
- },
- "1115": {
- "description": "Min/Max Unidirectional Link Delay",
- "type": 1115,
- "length": 8,
- "data": {
- "anomalous": false,
- "minDelay": 8000,
- "maxDelay": 9000
- },
- "dataUnit": "microseconds"
- },
- "1173": {
- "description": "Extended Administrative Group",
- "type": 1173,
- "length": 4,
- "data": "0x00000001"
- }
- }
- }
- }
-}
assert result is None, "Failed to see BGP prefixes on {}".format(rname)
-def test_show_bgp_link_state_detail():
- tgen = get_topogen()
-
- if tgen.routers_have_failure():
- pytest.skip(tgen.errors)
-
- def _show_bgp_link_state_json(rname, expected):
- output = json.loads(
- tgen.gears[rname].vtysh_cmd("show bgp link-state link-state detail-routes json")
- )
- json_output = {
- prefix.split("/")[0] + "/XX": item["linkStateAttributes"]
- for prefix, data in output["routes"].items()
- for item in data
- if "linkStateAttributes" in item
- }
-
- return topotest.json_cmp(json_output, expected)
-
- step("Check BGP Link-State Attributes tables")
- for rname in ["r2", "r3"]:
- expected = open(
- os.path.join(CWD, "{}/linkstate_detail.json".format(rname))
- ).read()
- expected_json = json.loads(expected)
- test_func = functools.partial(_show_bgp_link_state_json, rname, expected_json)
- _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
- assert result is None, "Failed to display BGP-LS Attributes on {}".format(rname)
-
-
if __name__ == "__main__":
args = ["-s"] + sys.argv[1:]
sys.exit(pytest.main(args))