Skip to content

Commit

Permalink
topotests: apply black to bgp_path_selection
Browse files Browse the repository at this point in the history
Reformat bgp_path_selection with black

Signed-off-by: Louis Scalbert <[email protected]>
  • Loading branch information
louis-6wind committed Sep 26, 2023
1 parent 820abf6 commit 72b064c
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions tests/topotests/bgp_path_selection/test_bgp_path_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ def setup_module(mod):
for routern in range(1, 4):
tgen.gears["r{}".format(routern)].cmd("ip link add vrf1 type vrf table 10")
tgen.gears["r{}".format(routern)].cmd("ip link set vrf1 up")
tgen.gears["r{}".format(routern)].cmd("ip address add dev vrf1 {}.{}.{}.{}/32".format(routern, routern, routern,routern))
tgen.gears["r{}".format(routern)].cmd(
"ip address add dev vrf1 {}.{}.{}.{}/32".format(
routern, routern, routern, routern
)
)
tgen.gears["r{}".format(routern)].cmd("ip link add vrf2 type vrf table 20")
tgen.gears["r{}".format(routern)].cmd("ip link set vrf2 up")
tgen.gears["r{}".format(routern)].cmd(
Expand Down Expand Up @@ -91,6 +95,7 @@ def teardown_module(mod):
tgen = get_topogen()
tgen.stop_topology()


def test_bgp_path_selection_ecmp():
tgen = get_topogen()

Expand All @@ -114,7 +119,7 @@ def _bgp_check_path_selection_ecmp():
"aspath": {"string": "65002"},
"multipath": True,
"nexthops": [{"ip": "192.0.2.3", "metric": 20}],
}
},
]
}

Expand All @@ -134,7 +139,9 @@ def test_bgp_path_selection_vpn_ecmp():

def _bgp_check_path_selection_vpn_ecmp():
output = json.loads(
tgen.gears["r1"].vtysh_cmd("show bgp vrf vrf1 ipv4 unicast 192.0.2.8/32 json")
tgen.gears["r1"].vtysh_cmd(
"show bgp vrf vrf1 ipv4 unicast 192.0.2.8/32 json"
)
)
expected = {
"paths": [
Expand All @@ -149,7 +156,7 @@ def _bgp_check_path_selection_vpn_ecmp():
"aspath": {"string": "65002"},
"multipath": True,
"nexthops": [{"ip": "192.0.2.3", "metric": 20}],
}
},
]
}

Expand Down Expand Up @@ -229,13 +236,13 @@ def _bgp_check_path_selection_metric():
"valid": True,
"aspath": {"string": "65002"},
"nexthops": [{"ip": "192.0.2.2", "metric": 10}],
"bestpath":{ "selectionReason":"IGP Metric"},
"bestpath": {"selectionReason": "IGP Metric"},
},
{
"valid": True,
"aspath": {"string": "65002"},
"nexthops": [{"ip": "192.0.2.3", "metric": 20}],
}
},
]
}

Expand All @@ -258,21 +265,23 @@ def test_bgp_path_selection_vpn_metric():

def _bgp_check_path_selection_vpn_metric():
output = json.loads(
tgen.gears["r1"].vtysh_cmd("show bgp vrf vrf1 ipv4 unicast 192.0.2.8/32 json")
tgen.gears["r1"].vtysh_cmd(
"show bgp vrf vrf1 ipv4 unicast 192.0.2.8/32 json"
)
)
expected = {
"paths": [
{
"valid": True,
"aspath": {"string": "65002"},
"nexthops": [{"ip": "192.0.2.2", "metric": 10}],
"bestpath":{ "selectionReason":"IGP Metric"},
"bestpath": {"selectionReason": "IGP Metric"},
},
{
"valid": True,
"aspath": {"string": "65002"},
"nexthops": [{"ip": "192.0.2.3", "metric": 20}],
}
},
]
}

Expand Down

0 comments on commit 72b064c

Please sign in to comment.