Check if BGP has Loopback0 IP as its router ID#8576
Check if BGP has Loopback0 IP as its router ID#8576kellyyeh merged 20 commits intosonic-net:masterfrom
Conversation
|
The pre-commit check detected issues in the files touched by this pull request. Detailed pre-commit check results: To run the pre-commit checks locally, you can follow below steps:
|
| check_bgo_router_id_cmd = r"show ip bgp sum" | ||
| bgp_sum_result = self.duthost.shell(check_bgo_router_id_cmd, module_ignore_errors=True) | ||
| if bgp_sum_result["rc"] == 0: | ||
| match = re.search(r'BGP router identifier (\d+\.\d+\.\d+\.\d+)', bgp_sum_result["stdout"]) |
There was a problem hiding this comment.
Is there no way this data can be collected from DB or from a JSON output? The concern w/ CLI parsing is that if the format changes in future then the regex will fail and lead to false positives.
If there is no other way then this is acceptable.
There was a problem hiding this comment.
Found a way to get this in JSON! You could execute below vtysh command and get the json output. From it. routerId can be fetched.
$ vtysh -c "show ip bgp summary json"
{
"ipv4Unicast":{
"routerId":"10.1.0.32",
|
|
||
| loopback0 = str(self.mgFacts['minigraph_lo_interfaces'][0]['addr']) | ||
|
|
||
| return bgp_router_id == loopback0 |
There was a problem hiding this comment.
bgp_router_id is defined only when the match is successful. The check here can fail w/ bgp_router_id not defined if the match is not successful and fail ungracefully.
|
@StormLiangMS just FYI: this is a test gap that is being addressed. Today no test matches the router-id to be same as Loopback0's IP. With this change the verification will be done as part of sanity tests. |
|
The pre-commit check detected issues in the files touched by this pull request. Detailed pre-commit check results: To run the pre-commit checks locally, you can follow below steps:
|
|
The pre-commit check detected issues in the files touched by this pull request. Detailed pre-commit check results: To run the pre-commit checks locally, you can follow below steps:
|
|
The pre-commit check detected issues in the files touched by this pull request. Detailed pre-commit check results: To run the pre-commit checks locally, you can follow below steps:
|
|
The pre-commit check detected issues in the files touched by this pull request. Detailed pre-commit check results: To run the pre-commit checks locally, you can follow below steps:
|
|
The pre-commit check detected issues in the files touched by this pull request. Detailed pre-commit check results: To run the pre-commit checks locally, you can follow below steps:
|
| """ | ||
| check_bgp_router_id_cmd = r'vtysh -c "show ip bgp summary json"' | ||
| bgp_summary = self.duthost.shell(check_bgp_router_id_cmd, module_ignore_errors=True) | ||
| bgp_summary_json = json.loads(bgp_summary['stdout']) |
There was a problem hiding this comment.
Possible exception here if stdout is not in json format for some reason.
| return not check_result['failed'] | ||
|
|
||
| def _check_bgp_router_id(tbinfo): | ||
| duthost = kwargs['node'] |
There was a problem hiding this comment.
Looks like there is duplication of whole logic here. So can we put this into commons and import at both the places?
|
The pre-commit check detected issues in the files touched by this pull request. Detailed pre-commit check results: To run the pre-commit checks locally, you can follow below steps:
|
|
The pre-commit check detected issues in the files touched by this pull request. Detailed pre-commit check results: To run the pre-commit checks locally, you can follow below steps:
|
|
Hi @kellyyeh @vaibhavhd, this check will not work for chassis linecard which have single asic. Please check. |
Created PR #9090 |
|
Cherry-pick PR to 202205: #9134 |
|
@kellyyeh PR conflicts with 202012 branch |
This is a cherry-pick PR for #8576 and #9090 * Check if BGP has Loopback0 IP as its router ID (#8576) * Skip check_bgp_router_id on T2 devices (#9090) What is the motivation for this PR? An issue was found that T0 did not announce Loopback to T1, this check is to bridge the test gap to ensure bgp router identifier matches Loopback0 IP. How did you do it? Added in sanity_check to match bgp router id and loopback0 ip How did you verify/test it? Ran a advanced_reboot manually and checked expected log: BGP router identifier: https://elastictest.org/scheduler/testplan/649c780c75768730ce0de9f3
Description of PR
Summary:
Fixes # (issue)
Type of change
Back port request
Approach
What is the motivation for this PR?
An issue was found that T0 did not announce Loopback to T1, this check is to bridge the test gap to ensure bgp router identifier matches Loopback0 IP.
How did you do it?
Added in sanity_check to match bgp router id and loopback0 ip
How did you verify/test it?
Ran a advanced_reboot manually and checked expected log: BGP router identifier:
https://elastictest.org/scheduler/testplan/649c780c75768730ce0de9f3
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation