Merge pull request #6130 from ton31337/fix/remove_some_redundant_attributes_from_json

bgpd: Remove deprecated JSON fields for `show bgp ... json`
This commit is contained in:
Sri Mohana Singamsetty 2020-04-02 16:17:24 -07:00 committed by GitHub
commit dba3453515
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 116 additions and 166 deletions

View File

@ -7819,32 +7819,19 @@ void route_vty_out(struct vty *vty, const struct prefix *p,
/* MED/Metric */ /* MED/Metric */
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC)) if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC))
if (json_paths) { if (json_paths)
/*
* Adding "metric" field to match with corresponding
* CLI. "med" will be deprecated in future.
*/
json_object_int_add(json_path, "med", attr->med);
json_object_int_add(json_path, "metric", attr->med); json_object_int_add(json_path, "metric", attr->med);
} else else
vty_out(vty, "%10u", attr->med); vty_out(vty, "%10u", attr->med);
else if (!json_paths) else if (!json_paths)
vty_out(vty, " "); vty_out(vty, " ");
/* Local Pref */ /* Local Pref */
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)) if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))
if (json_paths) { if (json_paths)
/*
* Adding "locPrf" field to match with corresponding
* CLI. "localPref" will be deprecated in future.
*/
json_object_int_add(json_path, "localpref",
attr->local_pref);
json_object_int_add(json_path, "locPrf", json_object_int_add(json_path, "locPrf",
attr->local_pref); attr->local_pref);
} else else
vty_out(vty, "%7u", attr->local_pref); vty_out(vty, "%7u", attr->local_pref);
else if (!json_paths) else if (!json_paths)
vty_out(vty, " "); vty_out(vty, " ");
@ -7863,17 +7850,10 @@ void route_vty_out(struct vty *vty, const struct prefix *p,
/* Print aspath */ /* Print aspath */
if (attr->aspath) { if (attr->aspath) {
if (json_paths) { if (json_paths)
/*
* Adding "path" field to match with corresponding
* CLI. "aspath" will be deprecated in future.
*/
json_object_string_add(json_path, "aspath",
attr->aspath->str);
json_object_string_add(json_path, "path", json_object_string_add(json_path, "path",
attr->aspath->str); attr->aspath->str);
} else else
aspath_print_vty(vty, "%s", attr->aspath, " "); aspath_print_vty(vty, "%s", attr->aspath, " ");
} }
@ -8016,34 +7996,16 @@ void route_vty_out_tmp(struct vty *vty, const struct prefix *p,
json_object_int_add(json_net, "metric", json_object_int_add(json_net, "metric",
attr->med); attr->med);
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)) { if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF))
/*
* Adding "locPrf" field to match with
* corresponding CLI. "localPref" will be
* deprecated in future.
*/
json_object_int_add(json_net, "localPref",
attr->local_pref);
json_object_int_add(json_net, "locPrf", json_object_int_add(json_net, "locPrf",
attr->local_pref); attr->local_pref);
}
json_object_int_add(json_net, "weight", attr->weight); json_object_int_add(json_net, "weight", attr->weight);
/* Print aspath */ /* Print aspath */
if (attr->aspath) { if (attr->aspath)
/*
* Adding "path" field to match with
* corresponding CLI. "localPref" will be
* deprecated in future.
*/
json_object_string_add(json_net, "asPath",
attr->aspath->str);
json_object_string_add(json_net, "path", json_object_string_add(json_net, "path",
attr->aspath->str); attr->aspath->str);
}
/* Print origin */ /* Print origin */
json_object_string_add(json_net, "bgpOriginCode", json_object_string_add(json_net, "bgpOriginCode",
@ -9077,21 +9039,15 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp,
bgp_origin_long_str[attr->origin]); bgp_origin_long_str[attr->origin]);
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC)) { if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC)) {
if (json_paths) { if (json_paths)
/*
* Adding "metric" field to match with
* corresponding CLI. "med" will be
* deprecated in future.
*/
json_object_int_add(json_path, "med", attr->med);
json_object_int_add(json_path, "metric", attr->med); json_object_int_add(json_path, "metric", attr->med);
} else else
vty_out(vty, ", metric %u", attr->med); vty_out(vty, ", metric %u", attr->med);
} }
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)) { if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)) {
if (json_paths) if (json_paths)
json_object_int_add(json_path, "localpref", json_object_int_add(json_path, "locPrf",
attr->local_pref); attr->local_pref);
else else
vty_out(vty, ", localpref %u", attr->local_pref); vty_out(vty, ", localpref %u", attr->local_pref);

View File

@ -14,7 +14,6 @@
"prefix": "2001:db8:6::", "prefix": "2001:db8:6::",
"prefixLen": 64, "prefixLen": 64,
"network": "2001:db8:6::\/64", "network": "2001:db8:6::\/64",
"med": 0,
"metric": 0, "metric": 0,
"weight": 0, "weight": 0,
"peerId": "2001:db8:4::1", "peerId": "2001:db8:4::1",
@ -37,7 +36,6 @@
"prefix": "2001:db8:7::", "prefix": "2001:db8:7::",
"prefixLen": 64, "network": "prefixLen": 64, "network":
"2001:db8:7::\/64", "2001:db8:7::\/64",
"med": 0,
"metric": 0, "metric": 0,
"weight": 0, "weight": 0,
"peerId": "2001:db8:4::1", "peerId": "2001:db8:4::1",
@ -60,7 +58,6 @@
"prefix": "2001:db8:8::", "prefix": "2001:db8:8::",
"prefixLen": 64, "prefixLen": 64,
"network": "2001:db8:8::\/64", "network": "2001:db8:8::\/64",
"med": 0,
"metric": 0, "metric": 0,
"weight": 32768, "weight": 32768,
"peerId": "(unspec)", "peerId": "(unspec)",
@ -83,7 +80,6 @@
"prefix": "2001:db8:9::", "prefix": "2001:db8:9::",
"prefixLen": 64, "prefixLen": 64,
"network": "2001:db8:9::\/64", "network": "2001:db8:9::\/64",
"med": 0,
"metric": 0, "metric": 0,
"weight": 32768, "weight": 32768,
"peerId": "(unspec)", "peerId": "(unspec)",

View File

@ -13,7 +13,6 @@
"prefix": "2001:db8:6::", "prefix": "2001:db8:6::",
"prefixLen": 64, "prefixLen": 64,
"network": "2001:db8:6::\/64", "network": "2001:db8:6::\/64",
"med": 0,
"metric": 0, "metric": 0,
"weight": 32768, "weight": 32768,
"peerId": "(unspec)", "peerId": "(unspec)",
@ -36,7 +35,6 @@
"prefix": "2001:db8:7::", "prefix": "2001:db8:7::",
"prefixLen": 64, "prefixLen": 64,
"network": "2001:db8:7::\/64", "network": "2001:db8:7::\/64",
"med": 0,
"metric": 0, "metric": 0,
"weight": 32768, "weight": 32768,
"peerId": "(unspec)", "peerId": "(unspec)",

View File

@ -2,7 +2,7 @@
"routes": { "routes": {
"10.254.254.2/32": [ "10.254.254.2/32": [
{ {
"aspath": "102", "path": "102",
"prefix": "10.254.254.2", "prefix": "10.254.254.2",
"valid": true, "valid": true,
"peerId": "192.168.0.2", "peerId": "192.168.0.2",
@ -18,7 +18,7 @@
], ],
"10.254.254.3/32": [ "10.254.254.3/32": [
{ {
"aspath": "102 103", "path": "102 103",
"prefix": "10.254.254.3", "prefix": "10.254.254.3",
"valid": true, "valid": true,
"peerId": "192.168.0.2", "peerId": "192.168.0.2",
@ -34,7 +34,7 @@
], ],
"10.254.254.4/32": [ "10.254.254.4/32": [
{ {
"aspath": "102 104", "path": "102 104",
"prefix": "10.254.254.4", "prefix": "10.254.254.4",
"valid": true, "valid": true,
"peerId": "192.168.0.2", "peerId": "192.168.0.2",

View File

@ -2,7 +2,7 @@
"routes": { "routes": {
"10.254.254.1/32": [ "10.254.254.1/32": [
{ {
"aspath": "101", "path": "101",
"prefix": "10.254.254.1", "prefix": "10.254.254.1",
"valid": true, "valid": true,
"peerId": "192.168.0.1", "peerId": "192.168.0.1",
@ -18,7 +18,7 @@
], ],
"10.254.254.3/32": [ "10.254.254.3/32": [
{ {
"aspath": "103", "path": "103",
"prefix": "10.254.254.3", "prefix": "10.254.254.3",
"valid": true, "valid": true,
"peerId": "192.168.1.1", "peerId": "192.168.1.1",
@ -34,7 +34,7 @@
], ],
"10.254.254.4/32": [ "10.254.254.4/32": [
{ {
"aspath": "104", "path": "104",
"prefix": "10.254.254.4", "prefix": "10.254.254.4",
"valid": true, "valid": true,
"peerId": "192.168.2.1", "peerId": "192.168.2.1",

View File

@ -2,7 +2,7 @@
"routes": { "routes": {
"10.254.254.1/32": [ "10.254.254.1/32": [
{ {
"aspath": "102 101", "path": "102 101",
"prefix": "10.254.254.1", "prefix": "10.254.254.1",
"valid": true, "valid": true,
"peerId": "192.168.1.2", "peerId": "192.168.1.2",
@ -18,7 +18,7 @@
], ],
"10.254.254.2/32": [ "10.254.254.2/32": [
{ {
"aspath": "102", "path": "102",
"prefix": "10.254.254.2", "prefix": "10.254.254.2",
"valid": true, "valid": true,
"peerId": "192.168.1.2", "peerId": "192.168.1.2",
@ -34,7 +34,7 @@
], ],
"10.254.254.4/32": [ "10.254.254.4/32": [
{ {
"aspath": "102 104", "path": "102 104",
"prefix": "10.254.254.4", "prefix": "10.254.254.4",
"valid": true, "valid": true,
"peerId": "192.168.1.2", "peerId": "192.168.1.2",

View File

@ -2,7 +2,7 @@
"routes": { "routes": {
"10.254.254.1/32": [ "10.254.254.1/32": [
{ {
"aspath": "102 101", "path": "102 101",
"prefix": "10.254.254.1", "prefix": "10.254.254.1",
"valid": true, "valid": true,
"peerId": "192.168.2.2", "peerId": "192.168.2.2",
@ -18,7 +18,7 @@
], ],
"10.254.254.2/32": [ "10.254.254.2/32": [
{ {
"aspath": "102", "path": "102",
"prefix": "10.254.254.2", "prefix": "10.254.254.2",
"valid": true, "valid": true,
"peerId": "192.168.2.2", "peerId": "192.168.2.2",
@ -34,7 +34,7 @@
], ],
"10.254.254.3/32": [ "10.254.254.3/32": [
{ {
"aspath": "102 103", "path": "102 103",
"prefix": "10.254.254.3", "prefix": "10.254.254.3",
"valid": true, "valid": true,
"peerId": "192.168.2.2", "peerId": "192.168.2.2",

View File

@ -2,7 +2,7 @@
"routes": { "routes": {
"10.254.254.2/32": [ "10.254.254.2/32": [
{ {
"aspath": "102", "path": "102",
"prefix": "10.254.254.2", "prefix": "10.254.254.2",
"valid": true, "valid": true,
"peerId": "192.168.0.2", "peerId": "192.168.0.2",
@ -18,7 +18,7 @@
], ],
"10.254.254.3/32": [ "10.254.254.3/32": [
{ {
"aspath": "102 103", "path": "102 103",
"prefix": "10.254.254.3", "prefix": "10.254.254.3",
"valid": true, "valid": true,
"peerId": "192.168.0.2", "peerId": "192.168.0.2",
@ -34,7 +34,7 @@
], ],
"10.254.254.4/32": [ "10.254.254.4/32": [
{ {
"aspath": "102 104", "path": "102 104",
"prefix": "10.254.254.4", "prefix": "10.254.254.4",
"valid": true, "valid": true,
"peerId": "192.168.0.2", "peerId": "192.168.0.2",

View File

@ -2,7 +2,7 @@
"routes": { "routes": {
"10.254.254.1/32": [ "10.254.254.1/32": [
{ {
"aspath": "101", "path": "101",
"prefix": "10.254.254.1", "prefix": "10.254.254.1",
"valid": true, "valid": true,
"peerId": "192.168.0.1", "peerId": "192.168.0.1",
@ -18,7 +18,7 @@
], ],
"10.254.254.3/32": [ "10.254.254.3/32": [
{ {
"aspath": "103", "path": "103",
"prefix": "10.254.254.3", "prefix": "10.254.254.3",
"valid": true, "valid": true,
"peerId": "192.168.1.1", "peerId": "192.168.1.1",
@ -34,7 +34,7 @@
], ],
"10.254.254.4/32": [ "10.254.254.4/32": [
{ {
"aspath": "104", "path": "104",
"prefix": "10.254.254.4", "prefix": "10.254.254.4",
"valid": true, "valid": true,
"peerId": "192.168.2.1", "peerId": "192.168.2.1",

View File

@ -2,7 +2,7 @@
"routes": { "routes": {
"10.254.254.1/32": [ "10.254.254.1/32": [
{ {
"aspath": "102 101", "path": "102 101",
"prefix": "10.254.254.1", "prefix": "10.254.254.1",
"valid": true, "valid": true,
"peerId": "192.168.1.2", "peerId": "192.168.1.2",
@ -18,7 +18,7 @@
], ],
"10.254.254.2/32": [ "10.254.254.2/32": [
{ {
"aspath": "102", "path": "102",
"prefix": "10.254.254.2", "prefix": "10.254.254.2",
"valid": true, "valid": true,
"peerId": "192.168.1.2", "peerId": "192.168.1.2",
@ -34,7 +34,7 @@
], ],
"10.254.254.4/32": [ "10.254.254.4/32": [
{ {
"aspath": "102 104", "path": "102 104",
"prefix": "10.254.254.4", "prefix": "10.254.254.4",
"valid": true, "valid": true,
"peerId": "192.168.1.2", "peerId": "192.168.1.2",

View File

@ -2,7 +2,7 @@
"routes": { "routes": {
"10.254.254.1/32": [ "10.254.254.1/32": [
{ {
"aspath": "102 101", "path": "102 101",
"prefix": "10.254.254.1", "prefix": "10.254.254.1",
"valid": true, "valid": true,
"peerId": "192.168.2.2", "peerId": "192.168.2.2",
@ -18,7 +18,7 @@
], ],
"10.254.254.2/32": [ "10.254.254.2/32": [
{ {
"aspath": "102", "path": "102",
"prefix": "10.254.254.2", "prefix": "10.254.254.2",
"valid": true, "valid": true,
"peerId": "192.168.2.2", "peerId": "192.168.2.2",
@ -34,7 +34,7 @@
], ],
"10.254.254.3/32": [ "10.254.254.3/32": [
{ {
"aspath": "102 103", "path": "102 103",
"prefix": "10.254.254.3", "prefix": "10.254.254.3",
"valid": true, "valid": true,
"peerId": "192.168.2.2", "peerId": "192.168.2.2",

View File

@ -430,7 +430,7 @@ def test_aspath_attribute(request):
# Verifying best path # Verifying best path
dut = "r1" dut = "r1"
attribute = "aspath" attribute = "path"
for addr_type in ADDR_TYPES: for addr_type in ADDR_TYPES:
result = verify_best_path_as_per_bgp_attribute(tgen, addr_type, dut, result = verify_best_path_as_per_bgp_attribute(tgen, addr_type, dut,
{"r7": input_dict["r7"]}, {"r7": input_dict["r7"]},
@ -479,7 +479,7 @@ def test_aspath_attribute(request):
} }
}, },
"set": { "set": {
"aspath": { "path": {
"as_num": "111 222", "as_num": "111 222",
"as_action": "prepend" "as_action": "prepend"
} }
@ -493,7 +493,7 @@ def test_aspath_attribute(request):
} }
}, },
"set": { "set": {
"aspath": { "path": {
"as_num": "111 222", "as_num": "111 222",
"as_action": "prepend" "as_action": "prepend"
} }
@ -553,7 +553,7 @@ def test_aspath_attribute(request):
# Verifying best path # Verifying best path
dut = "r1" dut = "r1"
attribute = "aspath" attribute = "path"
for addr_type in ADDR_TYPES: for addr_type in ADDR_TYPES:
result = verify_best_path_as_per_bgp_attribute(tgen, addr_type, dut, result = verify_best_path_as_per_bgp_attribute(tgen, addr_type, dut,
{"r7": input_dict["r7"]}, {"r7": input_dict["r7"]},
@ -714,7 +714,7 @@ def test_localpref_attribute(request):
} }
}, },
"set": { "set": {
"localpref": 1111 "locPrf": 1111
} }
}, },
{ {
@ -726,7 +726,7 @@ def test_localpref_attribute(request):
} }
}, },
"set": { "set": {
"localpref": 1111 "locPrf": 1111
} }
}] }]
} }
@ -783,7 +783,7 @@ def test_localpref_attribute(request):
# Verifying best path # Verifying best path
dut = "r1" dut = "r1"
attribute = "localpref" attribute = "locPrf"
for addr_type in ADDR_TYPES: for addr_type in ADDR_TYPES:
result = verify_best_path_as_per_bgp_attribute(tgen, addr_type, dut, result = verify_best_path_as_per_bgp_attribute(tgen, addr_type, dut,
{"r7": input_dict["r7"]}, {"r7": input_dict["r7"]},
@ -804,7 +804,7 @@ def test_localpref_attribute(request):
} }
}, },
"set": { "set": {
"localpref": 50 "locPrf": 50
} }
}, },
{ {
@ -816,7 +816,7 @@ def test_localpref_attribute(request):
} }
}, },
"set": { "set": {
"localpref": 50 "locPrf": 50
} }
}] }]
} }
@ -828,7 +828,7 @@ def test_localpref_attribute(request):
# Verifying best path # Verifying best path
dut = "r1" dut = "r1"
attribute = "localpref" attribute = "locPrf"
for addr_type in ADDR_TYPES: for addr_type in ADDR_TYPES:
result = verify_best_path_as_per_bgp_attribute(tgen, addr_type, dut, result = verify_best_path_as_per_bgp_attribute(tgen, addr_type, dut,
{"r7": input_dict["r7"]}, {"r7": input_dict["r7"]},
@ -1437,7 +1437,7 @@ def test_med_attribute(request):
} }
}, },
"set": { "set": {
"med": 100 "metric": 100
} }
}, },
{ {
@ -1449,7 +1449,7 @@ def test_med_attribute(request):
} }
}, },
"set": { "set": {
"med": 100 "metric": 100
} }
}] }]
} }
@ -1465,7 +1465,7 @@ def test_med_attribute(request):
} }
}, },
"set": { "set": {
"med": 10 "metric": 10
} }
}, },
{ {
@ -1477,7 +1477,7 @@ def test_med_attribute(request):
} }
}, },
"set": { "set": {
"med": 10 "metric": 10
} }
}] }]
} }
@ -1593,7 +1593,7 @@ def test_med_attribute(request):
# Verifying best path # Verifying best path
dut = "r1" dut = "r1"
attribute = "med" attribute = "metric"
for addr_type in ADDR_TYPES: for addr_type in ADDR_TYPES:
result = verify_best_path_as_per_bgp_attribute(tgen, addr_type, dut, result = verify_best_path_as_per_bgp_attribute(tgen, addr_type, dut,
input_dict, attribute) input_dict, attribute)
@ -1613,7 +1613,7 @@ def test_med_attribute(request):
} }
}, },
"set": { "set": {
"med": 200 "metric": 200
} }
}, },
{ {
@ -1625,7 +1625,7 @@ def test_med_attribute(request):
} }
}, },
"set": { "set": {
"med": 200 "metric": 200
} }
}] }]
} }
@ -1638,7 +1638,7 @@ def test_med_attribute(request):
# Verifying best path # Verifying best path
dut = "r1" dut = "r1"
attribute = "med" attribute = "metric"
for addr_type in ADDR_TYPES: for addr_type in ADDR_TYPES:
result = verify_best_path_as_per_bgp_attribute(tgen, addr_type, dut, result = verify_best_path_as_per_bgp_attribute(tgen, addr_type, dut,
input_dict, attribute) input_dict, attribute)

View File

@ -763,7 +763,7 @@ def test_route_map_multiple_seq_different_match_set_clause_p0(request):
} }
}, },
"set": { "set": {
"aspath": { "path": {
"as_num": 500 "as_num": 500
} }
} }
@ -777,7 +777,7 @@ def test_route_map_multiple_seq_different_match_set_clause_p0(request):
} }
}, },
"set": { "set": {
"localpref": 150, "locPrf": 150,
} }
}, },
{ {
@ -789,7 +789,7 @@ def test_route_map_multiple_seq_different_match_set_clause_p0(request):
} }
}, },
"set": { "set": {
"med": 50 "metric": 50
} }
} }
] ]
@ -878,7 +878,7 @@ def test_route_map_multiple_seq_different_match_set_clause_p0(request):
"route_maps": { "route_maps": {
"rmap_match_pf_list1": [{ "rmap_match_pf_list1": [{
"set": { "set": {
"med": 50, "metric": 50,
} }
}], }],
} }
@ -972,8 +972,8 @@ def test_route_map_set_only_no_match_p0(request):
{ {
"action": "permit", "action": "permit",
"set": { "set": {
"med": 50, "metric": 50,
"localpref": 150, "locPrf": 150,
"weight": 4000 "weight": 4000
} }
} }
@ -1059,7 +1059,7 @@ def test_route_map_set_only_no_match_p0(request):
{ {
"action": "permit", "action": "permit",
"set": { "set": {
"med": 50, "metric": 50,
} }
} }
] ]
@ -1176,8 +1176,8 @@ def test_route_map_match_only_no_set_p0(request):
"rmap_match_pf_1_{}".format(addr_type): [{ "rmap_match_pf_1_{}".format(addr_type): [{
"action": "permit", "action": "permit",
"set": { "set": {
"med": 50, "metric": 50,
"localpref": 150, "locPrf": 150,
} }
} }
] ]

View File

@ -288,7 +288,7 @@ def test_rmap_match_prefix_list_permit_in_and_outbound_prefixes_p0():
} }
}, },
"set": { "set": {
"localpref": 150, "locPrf": 150,
"weight": 100 "weight": 100
} }
}, },
@ -302,7 +302,7 @@ def test_rmap_match_prefix_list_permit_in_and_outbound_prefixes_p0():
} }
}, },
"set": { "set": {
"med": 50 "metric": 50
} }
}, },
] ]
@ -506,7 +506,7 @@ def test_modify_set_match_clauses_in_rmap_p0():
} }
}, },
"set": { "set": {
"localpref": 150, "locPrf": 150,
} }
}], }],
"rmap_match_pf_2_{}".format(addr_type): [{ "rmap_match_pf_2_{}".format(addr_type): [{
@ -518,7 +518,7 @@ def test_modify_set_match_clauses_in_rmap_p0():
} }
}, },
"set": { "set": {
"med": 50 "metric": 50
} }
}] }]
} }
@ -658,7 +658,7 @@ def test_modify_set_match_clauses_in_rmap_p0():
} }
}, },
"set": { "set": {
"localpref": 1000, "locPrf": 1000,
} }
}], }],
"rmap_match_pf_2_{}".format(addr_type): [{ "rmap_match_pf_2_{}".format(addr_type): [{
@ -670,7 +670,7 @@ def test_modify_set_match_clauses_in_rmap_p0():
} }
}, },
"set": { "set": {
"med": 2000 "metric": 2000
} }
}] }]
} }
@ -844,7 +844,7 @@ def test_modify_prefix_list_referenced_by_rmap_p0():
} }
}, },
"set": { "set": {
"localpref": 150, "locPrf": 150,
"weight": 100 "weight": 100
} }
}], }],
@ -857,7 +857,7 @@ def test_modify_prefix_list_referenced_by_rmap_p0():
} }
}, },
"set": { "set": {
"med": 50 "metric": 50
} }
}] }]
} }
@ -1093,7 +1093,7 @@ def test_remove_prefix_list_referenced_by_rmap_p0():
} }
}, },
"set": { "set": {
"localpref": 150, "locPrf": 150,
} }
}], }],
"rmap_match_pf_2_{}".format(addr_type): [{ "rmap_match_pf_2_{}".format(addr_type): [{
@ -1105,7 +1105,7 @@ def test_remove_prefix_list_referenced_by_rmap_p0():
} }
}, },
"set": { "set": {
"med": 50 "metric": 50
} }
}] }]
} }
@ -1639,7 +1639,7 @@ def test_multiple_match_statement_in_route_map_logical_ORed_p0():
} }
}, },
"set": { "set": {
"localpref": 150 "locPrf": 150
} }
}] }]
} }
@ -1664,7 +1664,7 @@ def test_multiple_match_statement_in_route_map_logical_ORed_p0():
} }
}, },
"set": { "set": {
"localpref": 200 "locPrf": 200
} }
}] }]
} }
@ -1894,7 +1894,7 @@ def test_multiple_match_statement_in_route_map_logical_ANDed_p1():
} }
}, },
"set": { "set": {
"localpref": 150, "locPrf": 150,
} }
}] }]
} }
@ -1919,7 +1919,7 @@ def test_multiple_match_statement_in_route_map_logical_ANDed_p1():
} }
}, },
"set": { "set": {
"localpref": 150, "locPrf": 150,
} }
}] }]
} }
@ -2043,7 +2043,7 @@ def test_add_remove_rmap_to_specific_neighbor_p0():
} }
}, },
"set": { "set": {
"localpref": 150, "locPrf": 150,
} }
}] }]
} }
@ -2234,7 +2234,7 @@ def test_clear_bgp_and_flap_interface_to_verify_rmap_properties_p0():
} }
}, },
"set": { "set": {
"localpref": 150, "locPrf": 150,
"weight": 100 "weight": 100
} }
}] }]
@ -2578,7 +2578,7 @@ def test_set_localpref_weight_to_ebgp_and_med_to_ibgp_peers_p0():
} }
}, },
"set": { "set": {
"med": 50 "metric": 50
} }
}], }],
"rmap_match_pf_2_{}".format(addr_type): [{ "rmap_match_pf_2_{}".format(addr_type): [{
@ -2589,7 +2589,7 @@ def test_set_localpref_weight_to_ebgp_and_med_to_ibgp_peers_p0():
addr_type) addr_type)
}}, }},
"set": { "set": {
"localpref": 150 "locPrf": 150
} }
}], }],
"rmap_match_pf_3_{}".format(addr_type): [{ "rmap_match_pf_3_{}".format(addr_type): [{
@ -2841,9 +2841,9 @@ def test_multiple_set_on_single_sequence_in_rmap_p0():
} }
}, },
"set": { "set": {
"localpref": 150, "locPrf": 150,
"weight": 100, "weight": 100,
"med": 50 "metric": 50
} }
}] }]
} }
@ -2985,7 +2985,7 @@ def test_route_maps_with_continue_clause_p0():
} }
}, },
"set": { "set": {
"localpref": 150 "locPrf": 150
}, },
"continue": "30" "continue": "30"
}, },
@ -2998,7 +2998,7 @@ def test_route_maps_with_continue_clause_p0():
} }
}, },
"set": { "set": {
"med": 200 "metric": 200
} }
}, },
{ {
@ -3010,7 +3010,7 @@ def test_route_maps_with_continue_clause_p0():
} }
}, },
"set": { "set": {
"med": 100 "metric": 100
} }
} }
] ]
@ -3167,7 +3167,7 @@ def test_route_maps_with_goto_clause_p0():
} }
}, },
"set": { "set": {
"med": 100 "metric": 100
} }
}, },
{ {
@ -3179,7 +3179,7 @@ def test_route_maps_with_goto_clause_p0():
} }
}, },
"set": { "set": {
"med": 200 "metric": 200
} }
} }
] ]
@ -3325,7 +3325,7 @@ def test_route_maps_with_call_clause_p0():
} }
}, },
"set": { "set": {
"localpref": 150 "locPrf": 150
}, },
"call": "rmap_match_pf_2_{}".format(addr_type) "call": "rmap_match_pf_2_{}".format(addr_type)
}], }],
@ -3337,7 +3337,7 @@ def test_route_maps_with_call_clause_p0():
} }
}, },
"set": { "set": {
"med": 200 "metric": 200
} }
}] }]
} }
@ -3486,7 +3486,7 @@ def test_create_rmap_match_prefix_list_to_deny_in_and_outbound_prefixes_p0():
} }
}, },
"set": { "set": {
"localpref": 150, "locPrf": 150,
} }
}], }],
"rmap_match_pf_2_{}".format(addr_type): [{ "rmap_match_pf_2_{}".format(addr_type): [{
@ -3497,7 +3497,7 @@ def test_create_rmap_match_prefix_list_to_deny_in_and_outbound_prefixes_p0():
} }
}, },
"set": { "set": {
"med": 50 "metric": 50
} }
}] }]
} }

View File

@ -110,7 +110,7 @@ def test_bgp_maximum_prefix_invalid():
expected = { expected = {
'paths': [ 'paths': [
{ {
'med': 123 'metric': 123
} }
] ]
} }

View File

@ -110,7 +110,7 @@ def test_bgp_default_originate_route_map():
expected = { expected = {
'paths': [ 'paths': [
{ {
'med': 123 'metric': 123
} }
] ]
} }

View File

@ -598,7 +598,7 @@ def config_for_as_path(tgen, topo, tc_name):
"community_list": {"id": "ANY"} "community_list": {"id": "ANY"}
}, },
"set": { "set": {
"aspath": { "path": {
"as_num": "4000000", "as_num": "4000000",
"as_action": "prepend" "as_action": "prepend"
} }

View File

@ -130,13 +130,13 @@ def test_bgp_reject_as_sets():
expected = { expected = {
'advertisedRoutes': { 'advertisedRoutes': {
'172.16.0.0/16': { '172.16.0.0/16': {
'asPath': '' 'path': ''
}, },
'192.168.254.0/30': { '192.168.254.0/30': {
'asPath': '65003' 'path': '65003'
}, },
'192.168.255.0/30': { '192.168.255.0/30': {
'asPath': '65001' 'path': '65001'
} }
}, },
'totalPrefixCounter': 3 'totalPrefixCounter': 3

View File

@ -113,7 +113,7 @@ def test_bgp_set_local_preference():
expected = { expected = {
'paths': [ 'paths': [
{ {
'localpref': 50, 'locPrf': 50,
'nexthops': [ 'nexthops': [
{ {
'ip': '192.168.255.3' 'ip': '192.168.255.3'
@ -121,7 +121,7 @@ def test_bgp_set_local_preference():
] ]
}, },
{ {
'localpref': 150, 'locPrf': 150,
'nexthops': [ 'nexthops': [
{ {
'ip': '192.168.255.2' 'ip': '192.168.255.2'

View File

@ -1256,7 +1256,7 @@ def verify_bgp_attributes(tgen, addr_type, dut, static_routes, rmap_name,
} }
}, },
"set": { "set": {
"localpref": 150, "locPrf": 150,
"weight": 100 "weight": 100
} }
}], }],
@ -1269,7 +1269,7 @@ def verify_bgp_attributes(tgen, addr_type, dut, static_routes, rmap_name,
} }
}, },
"set": { "set": {
"med": 50 "metric": 50
} }
}] }]
} }
@ -1406,7 +1406,7 @@ def verify_best_path_as_per_bgp_attribute(tgen, addr_type, router, input_dict,
} }
} }
} }
attribute = "localpref" attribute = "locPrf"
result = verify_best_path_as_per_bgp_attribute(tgen, "ipv4", dut, \ result = verify_best_path_as_per_bgp_attribute(tgen, "ipv4", dut, \
input_dict, attribute) input_dict, attribute)
Returns Returns
@ -1443,14 +1443,14 @@ def verify_best_path_as_per_bgp_attribute(tgen, addr_type, router, input_dict,
attribute_dict[next_hop_ip] = route_attribute[attribute] attribute_dict[next_hop_ip] = route_attribute[attribute]
# AS_PATH attribute # AS_PATH attribute
if attribute == "aspath": if attribute == "path":
# Find next_hop for the route have minimum as_path # Find next_hop for the route have minimum as_path
_next_hop = min(attribute_dict, key=lambda x: len(set( _next_hop = min(attribute_dict, key=lambda x: len(set(
attribute_dict[x]))) attribute_dict[x])))
compare = "SHORTEST" compare = "SHORTEST"
# LOCAL_PREF attribute # LOCAL_PREF attribute
elif attribute == "localpref": elif attribute == "locPrf":
# Find next_hop for the route have highest local preference # Find next_hop for the route have highest local preference
_next_hop = max(attribute_dict, key=(lambda k: _next_hop = max(attribute_dict, key=(lambda k:
attribute_dict[k])) attribute_dict[k]))
@ -1473,7 +1473,7 @@ def verify_best_path_as_per_bgp_attribute(tgen, addr_type, router, input_dict,
compare = "" compare = ""
# MED attribute # MED attribute
elif attribute == "med": elif attribute == "metric":
# Find next_hop for the route have LOWEST MED # Find next_hop for the route have LOWEST MED
_next_hop = min(attribute_dict, key=(lambda k: _next_hop = min(attribute_dict, key=(lambda k:
attribute_dict[k])) attribute_dict[k]))
@ -1548,7 +1548,7 @@ def verify_best_path_as_per_admin_distance(tgen, addr_type, router, input_dict,
{"network": "200.50.2.0/32", \ {"network": "200.50.2.0/32", \
"admin_distance": 60, "next_hop": "10.0.0.18"}] "admin_distance": 60, "next_hop": "10.0.0.18"}]
}} }}
attribute = "localpref" attribute = "locPrf"
result = verify_best_path_as_per_admin_distance(tgen, "ipv4", dut, \ result = verify_best_path_as_per_admin_distance(tgen, "ipv4", dut, \
input_dict, attribute): input_dict, attribute):
Returns Returns

View File

@ -1101,9 +1101,9 @@ def create_route_maps(tgen, input_dict, build=False):
"tag": "tag_id" "tag": "tag_id"
}, },
"set": { "set": {
"localpref": 150, "locPrf": 150,
"med": 30, "metric": 30,
"aspath": { "path": {
"num": 20000, "num": 20000,
"action": "prepend", "action": "prepend",
}, },
@ -1199,10 +1199,10 @@ def create_route_maps(tgen, input_dict, build=False):
set_data = rmap_dict["set"] set_data = rmap_dict["set"]
ipv4_data = set_data.setdefault("ipv4", {}) ipv4_data = set_data.setdefault("ipv4", {})
ipv6_data = set_data.setdefault("ipv6", {}) ipv6_data = set_data.setdefault("ipv6", {})
local_preference = set_data.setdefault("localpref", local_preference = set_data.setdefault("locPrf",
None) None)
metric = set_data.setdefault("med", None) metric = set_data.setdefault("metric", None)
as_path = set_data.setdefault("aspath", {}) as_path = set_data.setdefault("path", {})
weight = set_data.setdefault("weight", None) weight = set_data.setdefault("weight", None)
community = set_data.setdefault("community", {}) community = set_data.setdefault("community", {})
large_community = set_data.setdefault( large_community = set_data.setdefault(