15
15
16
16
logger = logging .getLogger (__name__ )
17
17
18
- def show_bgp_monitor (duthost ):
18
+ def get_bgp_monitor_runningconfig (duthost ):
19
19
""" Get bgp listener config
20
20
"""
21
- cmds = "show ip bgp summary "
21
+ cmds = "show runningconfiguration bgp"
22
22
output = duthost .shell (cmds )
23
23
pytest_assert (not output ['rc' ],
24
24
"'{}' failed with rc={}" .format (cmds , output ['rc' ])
25
25
)
26
26
27
27
# Sample:
28
- # Neighbhor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd NeighborName
29
- # ----------- --- ----- --------- --------- -------- ----- ------ --------- -------------- --------------
30
- # 11.0.0.1 4 65100 0 0 0 0 0 never Connect BGPMonitor
31
- bgp_listener_pattern = r".*BGPMonitor.*"
28
+ # neighbor 11.0.0.1 description BGPMonitor
29
+ bgp_listener_pattern = r"\s+neighbor.*description BGPMonitor"
32
30
bgp_listener_config = re .findall (bgp_listener_pattern , output ['stdout' ])
33
31
return bgp_listener_config
34
32
@@ -41,15 +39,15 @@ def setup_env(duthosts, rand_one_dut_hostname):
41
39
rand_selected_dut: The fixture returns a randomly selected DuT.
42
40
"""
43
41
duthost = duthosts [rand_one_dut_hostname ]
44
- original_bgp_listener_config = show_bgp_monitor (duthost )
42
+ original_bgp_listener_config = get_bgp_monitor_runningconfig (duthost )
45
43
create_checkpoint (duthost )
46
44
47
45
yield
48
46
49
47
try :
50
48
logger .info ("Rolled back to original checkpoint" )
51
49
rollback_or_reload (duthost )
52
- current_bgp_listener_config = show_bgp_monitor (duthost )
50
+ current_bgp_listener_config = get_bgp_monitor_runningconfig (duthost )
53
51
pytest_assert (set (original_bgp_listener_config ) == set (current_bgp_listener_config ),
54
52
"bgp listener config are not suppose to change after test"
55
53
)
0 commit comments