Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Improve BGP dynamic capability tests #14470

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
!
!debug bgp neighbor
!
int r1-eth0
ip address 192.168.1.1/24
!
router bgp 65001
no bgp ebgp-requires-policy
bgp graceful-restart
Expand Down
4 changes: 0 additions & 4 deletions tests/topotests/bgp_dynamic_capability/r1/zebra.conf

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
!
!debug bgp neighbor
!
int lo
ip address 10.10.10.10/32
!
int r2-eth0
ip address 192.168.1.2/24
!
router bgp 65002
bgp graceful-restart
bgp long-lived stale-time 20
Expand All @@ -9,4 +15,8 @@ router bgp 65002
neighbor 192.168.1.1 timers 1 3
neighbor 192.168.1.1 timers connect 1
neighbor 192.168.1.1 capability dynamic
!
address-family ipv4 unicast
redistribute connected
exit-address-family
!
4 changes: 0 additions & 4 deletions tests/topotests/bgp_dynamic_capability/r2/zebra.conf

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,8 @@ def setup_module(mod):

router_list = tgen.routers()

for i, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
router.load_config(
TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname))
)
for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_frr_config(os.path.join(CWD, "{}/frr.conf".format(rname)))

tgen.start_router()

Expand Down Expand Up @@ -85,8 +80,6 @@ def _bgp_converge():
}
},
},
"connectionsEstablished": 1,
"connectionsDropped": 0,
}
}
return topotest.json_cmp(output, expected)
Expand All @@ -101,6 +94,9 @@ def _bgp_converge():
"Change Graceful-Restart restart-time, LLGR stale-time and check if they changed dynamically"
)

# Clear message stats to check if we receive a notification or not after we
# change the settings fo LLGR.
r1.vtysh_cmd("clear bgp 192.168.1.2 message-stats")
r2.vtysh_cmd(
"""
configure terminal
Expand Down Expand Up @@ -132,8 +128,10 @@ def _bgp_check_if_session_not_reset_after_changing_gr_settings():
}
},
},
"connectionsEstablished": 1,
"connectionsDropped": 0,
"messageStats": {
"notificationsRecv": 0,
"capabilityRecv": 2,
},
}
}
return topotest.json_cmp(output, expected)
Expand All @@ -150,6 +148,9 @@ def _bgp_check_if_session_not_reset_after_changing_gr_settings():
"Disable Graceful-Restart notification support, and check if it's changed dynamically"
)

# Clear message stats to check if we receive a notification or not after we
# change the settings fo LLGR.
r1.vtysh_cmd("clear bgp 192.168.1.2 message-stats")
r2.vtysh_cmd(
"""
configure terminal
Expand Down Expand Up @@ -180,8 +181,10 @@ def _bgp_check_if_session_not_reset_after_changing_notification():
}
},
},
"connectionsEstablished": 1,
"connectionsDropped": 0,
"messageStats": {
"notificationsRecv": 0,
"capabilityRecv": 1,
},
}
}
return topotest.json_cmp(output, expected)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,8 @@ def setup_module(mod):

router_list = tgen.routers()

for i, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
router.load_config(
TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname))
)
for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_frr_config(os.path.join(CWD, "{}/frr.conf".format(rname)))

tgen.start_router()

Expand Down Expand Up @@ -71,8 +66,6 @@ def _bgp_converge():
"neighborCapabilities": {
"dynamic": "advertisedAndReceived",
},
"connectionsEstablished": 1,
"connectionsDropped": 0,
}
}
return topotest.json_cmp(output, expected)
Expand All @@ -85,6 +78,9 @@ def _bgp_converge():

step("Set local-role and check if it's exchanged dynamically")

# Clear message stats to check if we receive a notification or not after we
# change the settings fo LLGR.
r1.vtysh_cmd("clear bgp 192.168.1.2 message-stats")
r1.vtysh_cmd(
"""
configure terminal
Expand Down Expand Up @@ -112,8 +108,10 @@ def _bgp_check_if_session_not_reset():
"dynamic": "advertisedAndReceived",
"role": "advertisedAndReceived",
},
"connectionsEstablished": 1,
"connectionsDropped": 0,
"messageStats": {
"notificationsRecv": 0,
"capabilityRecv": 1,
},
}
}
return topotest.json_cmp(output, expected)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,8 @@ def setup_module(mod):

router_list = tgen.routers()

for i, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
router.load_config(
TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname))
)
for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_frr_config(os.path.join(CWD, "{}/frr.conf".format(rname)))

tgen.start_router()

Expand Down Expand Up @@ -73,8 +68,6 @@ def _bgp_converge():
"receivedSoftwareVersion": None,
},
},
"connectionsEstablished": 1,
"connectionsDropped": 0,
}
}
return topotest.json_cmp(output, expected)
Expand All @@ -87,6 +80,9 @@ def _bgp_converge():

step("Enable software version capability and check if it's exchanged dynamically")

# Clear message stats to check if we receive a notification or not after we
# change the settings fo LLGR.
r1.vtysh_cmd("clear bgp 192.168.1.2 message-stats")
r1.vtysh_cmd(
"""
configure terminal
Expand Down Expand Up @@ -133,8 +129,10 @@ def _bgp_software_version():
"receivedSoftwareVersion": rcv,
},
},
"connectionsEstablished": 1,
"connectionsDropped": 0,
"messageStats": {
"notificationsRecv": 0,
"capabilityRecv": 1,
},
}
}
return topotest.json_cmp(output, expected)
Expand Down