tests: Remove/change JSON attributes for show bgp ... json

This is related to some attributes changes: aspath, med, localPref.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
This commit is contained in:
Donatas Abraitis 2020-04-01 17:04:08 +03:00
parent 0fbac0b478
commit 0a9fe278f6
20 changed files with 101 additions and 107 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -763,7 +763,7 @@ def test_route_map_multiple_seq_different_match_set_clause_p0(request):
}
},
"set": {
"aspath": {
"path": {
"as_num": 500
}
}
@ -777,7 +777,7 @@ def test_route_map_multiple_seq_different_match_set_clause_p0(request):
}
},
"set": {
"localpref": 150,
"locPrf": 150,
}
},
{
@ -789,7 +789,7 @@ def test_route_map_multiple_seq_different_match_set_clause_p0(request):
}
},
"set": {
"med": 50
"metric": 50
}
}
]
@ -878,7 +878,7 @@ def test_route_map_multiple_seq_different_match_set_clause_p0(request):
"route_maps": {
"rmap_match_pf_list1": [{
"set": {
"med": 50,
"metric": 50,
}
}],
}
@ -972,8 +972,8 @@ def test_route_map_set_only_no_match_p0(request):
{
"action": "permit",
"set": {
"med": 50,
"localpref": 150,
"metric": 50,
"locPrf": 150,
"weight": 4000
}
}
@ -1059,7 +1059,7 @@ def test_route_map_set_only_no_match_p0(request):
{
"action": "permit",
"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): [{
"action": "permit",
"set": {
"med": 50,
"localpref": 150,
"metric": 50,
"locPrf": 150,
}
}
]

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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