Skip to content

Add FRR failed route check in route_check.py#4119

Merged
StormLiangMS merged 6 commits intosonic-net:masterfrom
ZhaohuiS:ZhaohuiS/route_check_failed_frr
Nov 10, 2025
Merged

Add FRR failed route check in route_check.py#4119
StormLiangMS merged 6 commits intosonic-net:masterfrom
ZhaohuiS:ZhaohuiS/route_check_failed_frr

Conversation

@ZhaohuiS
Copy link
Contributor

@ZhaohuiS ZhaohuiS commented Nov 5, 2025

What I did

It supports to detect the route with offload False or without offload, which can capture queued route, because queued route doesn’t have offload, but for rejected route, the offload is True. It can’t detect the rejected route.
So, we add a new detection check for the value of key failed for route entries, which can cover both rejected and queued routes.
It will help to detect rejected route and queued route on device.

How I did it

Append failed route prefix into failed list, if it's not empty, script will print error message into syslog

        # Check for failed state
        if entry.get('failed', False):
            failed_rt.append(route_prefix)

How to verify it

  • For rejected route:

The output of route_check.py

Some routes have failed state in FRR : ['0.0.0.0/0', '192.168.128.0/25', '192.168.128.128/25', '192.168.136.0/25', '192.168.136.128/25', '192.168.144.0/25', '192.168.144.128/25', '192.168.152.0/25', '192.168.152.128/25', '192.168.160.0/25', '192.168.160.128/25', '192.168.168.0/25', '192.168.168.128/25', '192.168.176.0/25', '192.168.176.128/25', '192.168.184.0/25', '192.168.184.128/25', '192.168.192.0/25', '192.168.192.128/25', '192.168.200.0/25', '192.168.200.128/25', '192.168.208.0/25', '192.168.208.128/25', '192.168.216.0/25', '192.168.216.128/25', '192.168.224.0/25', '192.168.224.128/25', '192.168.232.0/25', '192.168.232.128/25', '192.168.240.0/25', '192.168.240.128/25', '192.168.248.0/25', '192.168.248.128/25', '192.169.0.0/25', '192.169.0.128/25', '192.169.104.0/25', '192.169.104.128/25', '192.169.112.0/25', '192.169.112.128/25', '192.169.120.0/25', '192.169.120.128/25', '192.169.128.0/25', '192.169.128.128/25', '192.169.136.0/25', '192.169.136.128/25', '192.169.144.0/25', '192.16
Failure results: {{
    "": {
        "failed_FRR_routes": [
            "0.0.0.0/0",
            "192.168.128.0/25",
            "192.168.128.128/25",
            "192.168.136.0/25",
            "192.168.136.128/25",
            "192.168.144.0/25",
            "192.168.144.128/25",
            "192.168.152.0/25",
            "192.168.152.128/25",
            "192.168.160.0/25",
            "192.168.160.128/25",
            "192.168.168.0/25",
            "192.168.168.128/25",
            "192.168.176.0/25",
            "192.168.176.128/25",
            "192.168.184.0/25",
            "192.168.184.128/25",
            "192.168.192.0/25",
            "192.168.192.128/25",
            "192.168.200.0/25",
            "192.168.200.128/25",
            "192.168.208.0/25",
            "192.168.208.128/25",
            "192.168.216.0/25",
            "192.168.216.128/25",
            "192.168.224.0/25",
            "192.168.224.128/25",
            "192.168.232.0/25",
            "192.168.232
Failed. Look at reported mismatches above
  • For rejected route:

the output of route_check.py

Some routes have failed state in FRR : ['0.0.0.0/0', '192.168.128.0/25', '192.168.128.128/25', '192.168.136.0/25', '192.168.136.128/25', '192.168.144.0/25', '192.168.144.128/25', '192.168.152.0/25', '192.168.152.128/25', '192.168.160.0/25', '192.168.160.128/25', '192.168.168.0/25', '192.168.168.128/25', '192.168.176.0/25', '192.168.176.128/25', '192.168.184.0/25', '192.168.184.128/25', '192.168.192.0/25', '192.168.192.128/25', '192.168.200.0/25', '192.168.200.128/25', '192.168.208.0/25', '192.168.208.128/25', '192.168.216.0/25', '192.168.216.128/25', '192.168.224.0/25', '192.168.224.128/25', '192.168.232.0/25', '192.168.232.128/25', '192.168.240.0/25', '192.168.240.128/25', '192.168.248.0/25', '192.168.248.128/25', '192.169.0.0/25', '192.169.0.128/25', '192.169.104.0/25', '192.169.104.128/25', '192.169.112.0/25', '192.169.112.128/25', '192.169.120.0/25', '192.169.120.128/25', '192.169.128.0/25', '192.169.128.128/25', '192.169.136.0/25', '192.169.136.128/25', '192.169.144.0/25', '192.16
Failure results: {{
    "": {
        "missed_FRR_routes": [
            {
                "destSelected": true,
                "distance": 20,
                "failed": true,
                "installedNexthopGroupId": 39146,
                "internalFlags": 8,
                "internalNextHopActiveNum": 4,
                "internalNextHopNum": 4,
                "internalStatus": 168,
                "metric": 0,
                "nexthopGroupId": 39146,
                "nexthops": [
                    {
                        "active": true,
                        "afi": "ipv4",
                        "fib": true,
                        "flags": 3,
                        "interfaceIndex": 6,
                        "interfaceName": "PortChannel102",
                        "ip": "10.0.0.1",
                        "rmapSource": "10.1.0.32",
                        "weight": 1
                    },
                    {
                        "active": true,
                  
Failed. Look at reported mismatches above

Previous command output (if the output of a command-line utility has changed)

New command output (if the output of a command-line utility has changed)

Copilot AI review requested due to automatic review settings November 5, 2025 06:06
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds detection and reporting of failed FRR routes in addition to the existing missed routes tracking. The change enhances route checking by identifying routes with a "failed" state in FRR and reporting them separately.

  • Tracks failed FRR routes alongside missed routes
  • Updates function signature to return both missed and failed routes
  • Adds separate error logging for failed routes
Comments suppressed due to low confidence (1)

scripts/route_check.py:706

    print_message(syslog.LOG_DEBUG, "FRR failed routes: {}".format(failed_rt, indent=4))

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if not missed_rt:
if entry.get('failed', False):
failed_rt.append(route_prefix)
if not missed_rt or not failed_rt:
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The loop termination condition uses or instead of and, causing the retry loop to exit prematurely if either list is empty. This means if there are failed routes but no missed routes (or vice versa), the function will stop retrying immediately. The condition should be if not missed_rt and not failed_rt: to only exit when both lists are empty.

Suggested change
if not missed_rt or not failed_rt:
if not missed_rt and not failed_rt:

Copilot uses AI. Check for mistakes.
Comment on lines +702 to +706
print_message(syslog.LOG_DEBUG, "FRR missed routes: {}".format(missed_rt, indent=4))
return missed_rt
print_message(syslog.LOG_DEBUG, "FRR failed routes: {}".format(failed_rt, indent=4))
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The str.format() method doesn't accept an indent parameter. This appears to be attempting to use json.dumps() formatting style but is calling it on a plain format string. Either remove the indent=4 parameter or use json.dumps(missed_rt, indent=4) and json.dumps(failed_rt, indent=4) to properly format the output.

Copilot uses AI. Check for mistakes.
if is_suppress_fib_pending_enabled(namespace):
mitigate_installed_not_offloaded_frr_routes(namespace, rt_frr_miss, rt_appl)
if rt_frr_failed:
print_message(syslog.LOG_ERR, "Some routes have failed state in FRR {}: {}".format(namespace, rt_frr_failed))
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The error message format is inconsistent with line 908-909 which uses 'in FRR{}' (no space before the curly brace). This message uses 'in FRR {}' (with a space). For consistency, consider matching the format used in the similar error message above.

Suggested change
print_message(syslog.LOG_ERR, "Some routes have failed state in FRR {}: {}".format(namespace, rt_frr_failed))
print_message(syslog.LOG_ERR, "Some routes have failed state in FRR{}: {}".format(namespace, rt_frr_failed))

Copilot uses AI. Check for mistakes.
Signed-off-by: Zhaohui Sun <[email protected]>
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Zhaohui Sun <[email protected]>
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Zhaohui Sun <[email protected]>
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Zhaohui Sun <[email protected]>
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Zhaohui Sun <[email protected]>
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@StormLiangMS StormLiangMS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@StormLiangMS StormLiangMS merged commit 311add2 into sonic-net:master Nov 10, 2025
7 checks passed
gordon-nexthop pushed a commit to nexthop-ai/sonic-utilities that referenced this pull request Nov 25, 2025
What I did
It supports to detect the route with offload False or without offload, which can capture queued route, because queued route doesn’t have offload, but for rejected route, the offload is True. It can’t detect the rejected route.
So, we add a new detection check for the value of key failed for route entries, which can cover both rejected and queued routes.
It will help to detect rejected route and queued route on device.

How I did it
Append failed route prefix into failed list, if it's not empty, script will print error message into syslog

        # Check for failed state
        if entry.get('failed', False):
            failed_rt.append(route_prefix)
How to verify it
For rejected route:
The output of route_check.py

Some routes have failed state in FRR : ['0.0.0.0/0', '192.168.128.0/25', '192.168.128.128/25', '192.168.136.0/25', '192.168.136.128/25', '192.168.144.0/25', '192.168.144.128/25', '192.168.152.0/25', '192.168.152.128/25', '192.168.160.0/25', '192.168.160.128/25', '192.168.168.0/25', '192.168.168.128/25', '192.168.176.0/25', '192.168.176.128/25', '192.168.184.0/25', '192.168.184.128/25', '192.168.192.0/25', '192.168.192.128/25', '192.168.200.0/25', '192.168.200.128/25', '192.168.208.0/25', '192.168.208.128/25', '192.168.216.0/25', '192.168.216.128/25', '192.168.224.0/25', '192.168.224.128/25', '192.168.232.0/25', '192.168.232.128/25', '192.168.240.0/25', '192.168.240.128/25', '192.168.248.0/25', '192.168.248.128/25', '192.169.0.0/25', '192.169.0.128/25', '192.169.104.0/25', '192.169.104.128/25', '192.169.112.0/25', '192.169.112.128/25', '192.169.120.0/25', '192.169.120.128/25', '192.169.128.0/25', '192.169.128.128/25', '192.169.136.0/25', '192.169.136.128/25', '192.169.144.0/25', '192.16
Failure results: {{
    "": {
        "failed_FRR_routes": [
            "0.0.0.0/0",
            "192.168.128.0/25",
            "192.168.128.128/25",
            "192.168.136.0/25",
            "192.168.136.128/25",
            "192.168.144.0/25",
            "192.168.144.128/25",
            "192.168.152.0/25",
            "192.168.152.128/25",
            "192.168.160.0/25",
            "192.168.160.128/25",
            "192.168.168.0/25",
            "192.168.168.128/25",
            "192.168.176.0/25",
            "192.168.176.128/25",
            "192.168.184.0/25",
            "192.168.184.128/25",
            "192.168.192.0/25",
            "192.168.192.128/25",
            "192.168.200.0/25",
            "192.168.200.128/25",
            "192.168.208.0/25",
            "192.168.208.128/25",
            "192.168.216.0/25",
            "192.168.216.128/25",
            "192.168.224.0/25",
            "192.168.224.128/25",
            "192.168.232.0/25",
            "192.168.232
Failed. Look at reported mismatches above
For rejected route:
the output of route_check.py

Some routes have failed state in FRR : ['0.0.0.0/0', '192.168.128.0/25', '192.168.128.128/25', '192.168.136.0/25', '192.168.136.128/25', '192.168.144.0/25', '192.168.144.128/25', '192.168.152.0/25', '192.168.152.128/25', '192.168.160.0/25', '192.168.160.128/25', '192.168.168.0/25', '192.168.168.128/25', '192.168.176.0/25', '192.168.176.128/25', '192.168.184.0/25', '192.168.184.128/25', '192.168.192.0/25', '192.168.192.128/25', '192.168.200.0/25', '192.168.200.128/25', '192.168.208.0/25', '192.168.208.128/25', '192.168.216.0/25', '192.168.216.128/25', '192.168.224.0/25', '192.168.224.128/25', '192.168.232.0/25', '192.168.232.128/25', '192.168.240.0/25', '192.168.240.128/25', '192.168.248.0/25', '192.168.248.128/25', '192.169.0.0/25', '192.169.0.128/25', '192.169.104.0/25', '192.169.104.128/25', '192.169.112.0/25', '192.169.112.128/25', '192.169.120.0/25', '192.169.120.128/25', '192.169.128.0/25', '192.169.128.128/25', '192.169.136.0/25', '192.169.136.128/25', '192.169.144.0/25', '192.16
Failure results: {{
    "": {
        "missed_FRR_routes": [
            {
                "destSelected": true,
                "distance": 20,
                "failed": true,
                "installedNexthopGroupId": 39146,
                "internalFlags": 8,
                "internalNextHopActiveNum": 4,
                "internalNextHopNum": 4,
                "internalStatus": 168,
                "metric": 0,
                "nexthopGroupId": 39146,
                "nexthops": [
                    {
                        "active": true,
                        "afi": "ipv4",
                        "fib": true,
                        "flags": 3,
                        "interfaceIndex": 6,
                        "interfaceName": "PortChannel102",
                        "ip": "10.0.0.1",
                        "rmapSource": "10.1.0.32",
                        "weight": 1
                    },
                    {
                        "active": true,
                  
Failed. Look at reported mismatches above
@deepak-singhal0408
Copy link
Contributor

in 202405, this check is only run , when big_suppress_fib_pending feature is enabled(which is not)..

if is_bgp_suppress_fib_pending_enabled(namespace):
    rt_frr_miss = check_frr_pending_routes(namespace)

Also this command internally executes, "show ip route json", which is risky and known to have memory spike on scaled route systems.. hence, this PR cant go in 202405 branch.

YairRaviv pushed a commit to YairRaviv/sonic-utilities that referenced this pull request Jan 12, 2026
What I did
It supports to detect the route with offload False or without offload, which can capture queued route, because queued route doesn’t have offload, but for rejected route, the offload is True. It can’t detect the rejected route.
So, we add a new detection check for the value of key failed for route entries, which can cover both rejected and queued routes.
It will help to detect rejected route and queued route on device.

How I did it
Append failed route prefix into failed list, if it's not empty, script will print error message into syslog

        # Check for failed state
        if entry.get('failed', False):
            failed_rt.append(route_prefix)
How to verify it
For rejected route:
The output of route_check.py

Some routes have failed state in FRR : ['0.0.0.0/0', '192.168.128.0/25', '192.168.128.128/25', '192.168.136.0/25', '192.168.136.128/25', '192.168.144.0/25', '192.168.144.128/25', '192.168.152.0/25', '192.168.152.128/25', '192.168.160.0/25', '192.168.160.128/25', '192.168.168.0/25', '192.168.168.128/25', '192.168.176.0/25', '192.168.176.128/25', '192.168.184.0/25', '192.168.184.128/25', '192.168.192.0/25', '192.168.192.128/25', '192.168.200.0/25', '192.168.200.128/25', '192.168.208.0/25', '192.168.208.128/25', '192.168.216.0/25', '192.168.216.128/25', '192.168.224.0/25', '192.168.224.128/25', '192.168.232.0/25', '192.168.232.128/25', '192.168.240.0/25', '192.168.240.128/25', '192.168.248.0/25', '192.168.248.128/25', '192.169.0.0/25', '192.169.0.128/25', '192.169.104.0/25', '192.169.104.128/25', '192.169.112.0/25', '192.169.112.128/25', '192.169.120.0/25', '192.169.120.128/25', '192.169.128.0/25', '192.169.128.128/25', '192.169.136.0/25', '192.169.136.128/25', '192.169.144.0/25', '192.16
Failure results: {{
    "": {
        "failed_FRR_routes": [
            "0.0.0.0/0",
            "192.168.128.0/25",
            "192.168.128.128/25",
            "192.168.136.0/25",
            "192.168.136.128/25",
            "192.168.144.0/25",
            "192.168.144.128/25",
            "192.168.152.0/25",
            "192.168.152.128/25",
            "192.168.160.0/25",
            "192.168.160.128/25",
            "192.168.168.0/25",
            "192.168.168.128/25",
            "192.168.176.0/25",
            "192.168.176.128/25",
            "192.168.184.0/25",
            "192.168.184.128/25",
            "192.168.192.0/25",
            "192.168.192.128/25",
            "192.168.200.0/25",
            "192.168.200.128/25",
            "192.168.208.0/25",
            "192.168.208.128/25",
            "192.168.216.0/25",
            "192.168.216.128/25",
            "192.168.224.0/25",
            "192.168.224.128/25",
            "192.168.232.0/25",
            "192.168.232
Failed. Look at reported mismatches above
For rejected route:
the output of route_check.py

Some routes have failed state in FRR : ['0.0.0.0/0', '192.168.128.0/25', '192.168.128.128/25', '192.168.136.0/25', '192.168.136.128/25', '192.168.144.0/25', '192.168.144.128/25', '192.168.152.0/25', '192.168.152.128/25', '192.168.160.0/25', '192.168.160.128/25', '192.168.168.0/25', '192.168.168.128/25', '192.168.176.0/25', '192.168.176.128/25', '192.168.184.0/25', '192.168.184.128/25', '192.168.192.0/25', '192.168.192.128/25', '192.168.200.0/25', '192.168.200.128/25', '192.168.208.0/25', '192.168.208.128/25', '192.168.216.0/25', '192.168.216.128/25', '192.168.224.0/25', '192.168.224.128/25', '192.168.232.0/25', '192.168.232.128/25', '192.168.240.0/25', '192.168.240.128/25', '192.168.248.0/25', '192.168.248.128/25', '192.169.0.0/25', '192.169.0.128/25', '192.169.104.0/25', '192.169.104.128/25', '192.169.112.0/25', '192.169.112.128/25', '192.169.120.0/25', '192.169.120.128/25', '192.169.128.0/25', '192.169.128.128/25', '192.169.136.0/25', '192.169.136.128/25', '192.169.144.0/25', '192.16
Failure results: {{
    "": {
        "missed_FRR_routes": [
            {
                "destSelected": true,
                "distance": 20,
                "failed": true,
                "installedNexthopGroupId": 39146,
                "internalFlags": 8,
                "internalNextHopActiveNum": 4,
                "internalNextHopNum": 4,
                "internalStatus": 168,
                "metric": 0,
                "nexthopGroupId": 39146,
                "nexthops": [
                    {
                        "active": true,
                        "afi": "ipv4",
                        "fib": true,
                        "flags": 3,
                        "interfaceIndex": 6,
                        "interfaceName": "PortChannel102",
                        "ip": "10.0.0.1",
                        "rmapSource": "10.1.0.32",
                        "weight": 1
                    },
                    {
                        "active": true,
                  
Failed. Look at reported mismatches above
@r12f
Copy link

r12f commented Feb 1, 2026

hi @ZhaohuiS do you mind to help take this change to 202412 too?

@ZhaohuiS
Copy link
Contributor Author

ZhaohuiS commented Feb 3, 2026

@r12f PR for 202412 is here, please help review. Azure/sonic-utilities.msft#284
I think 202412 may also need this PR: #4205

PriyanshTratiya pushed a commit to PriyanshTratiya/sonic-utilities that referenced this pull request Mar 16, 2026
What I did
It supports to detect the route with offload False or without offload, which can capture queued route, because queued route doesn’t have offload, but for rejected route, the offload is True. It can’t detect the rejected route.
So, we add a new detection check for the value of key failed for route entries, which can cover both rejected and queued routes.
It will help to detect rejected route and queued route on device.

How I did it
Append failed route prefix into failed list, if it's not empty, script will print error message into syslog

        # Check for failed state
        if entry.get('failed', False):
            failed_rt.append(route_prefix)
How to verify it
For rejected route:
The output of route_check.py

Some routes have failed state in FRR : ['0.0.0.0/0', '192.168.128.0/25', '192.168.128.128/25', '192.168.136.0/25', '192.168.136.128/25', '192.168.144.0/25', '192.168.144.128/25', '192.168.152.0/25', '192.168.152.128/25', '192.168.160.0/25', '192.168.160.128/25', '192.168.168.0/25', '192.168.168.128/25', '192.168.176.0/25', '192.168.176.128/25', '192.168.184.0/25', '192.168.184.128/25', '192.168.192.0/25', '192.168.192.128/25', '192.168.200.0/25', '192.168.200.128/25', '192.168.208.0/25', '192.168.208.128/25', '192.168.216.0/25', '192.168.216.128/25', '192.168.224.0/25', '192.168.224.128/25', '192.168.232.0/25', '192.168.232.128/25', '192.168.240.0/25', '192.168.240.128/25', '192.168.248.0/25', '192.168.248.128/25', '192.169.0.0/25', '192.169.0.128/25', '192.169.104.0/25', '192.169.104.128/25', '192.169.112.0/25', '192.169.112.128/25', '192.169.120.0/25', '192.169.120.128/25', '192.169.128.0/25', '192.169.128.128/25', '192.169.136.0/25', '192.169.136.128/25', '192.169.144.0/25', '192.16
Failure results: {{
    "": {
        "failed_FRR_routes": [
            "0.0.0.0/0",
            "192.168.128.0/25",
            "192.168.128.128/25",
            "192.168.136.0/25",
            "192.168.136.128/25",
            "192.168.144.0/25",
            "192.168.144.128/25",
            "192.168.152.0/25",
            "192.168.152.128/25",
            "192.168.160.0/25",
            "192.168.160.128/25",
            "192.168.168.0/25",
            "192.168.168.128/25",
            "192.168.176.0/25",
            "192.168.176.128/25",
            "192.168.184.0/25",
            "192.168.184.128/25",
            "192.168.192.0/25",
            "192.168.192.128/25",
            "192.168.200.0/25",
            "192.168.200.128/25",
            "192.168.208.0/25",
            "192.168.208.128/25",
            "192.168.216.0/25",
            "192.168.216.128/25",
            "192.168.224.0/25",
            "192.168.224.128/25",
            "192.168.232.0/25",
            "192.168.232
Failed. Look at reported mismatches above
For rejected route:
the output of route_check.py

Some routes have failed state in FRR : ['0.0.0.0/0', '192.168.128.0/25', '192.168.128.128/25', '192.168.136.0/25', '192.168.136.128/25', '192.168.144.0/25', '192.168.144.128/25', '192.168.152.0/25', '192.168.152.128/25', '192.168.160.0/25', '192.168.160.128/25', '192.168.168.0/25', '192.168.168.128/25', '192.168.176.0/25', '192.168.176.128/25', '192.168.184.0/25', '192.168.184.128/25', '192.168.192.0/25', '192.168.192.128/25', '192.168.200.0/25', '192.168.200.128/25', '192.168.208.0/25', '192.168.208.128/25', '192.168.216.0/25', '192.168.216.128/25', '192.168.224.0/25', '192.168.224.128/25', '192.168.232.0/25', '192.168.232.128/25', '192.168.240.0/25', '192.168.240.128/25', '192.168.248.0/25', '192.168.248.128/25', '192.169.0.0/25', '192.169.0.128/25', '192.169.104.0/25', '192.169.104.128/25', '192.169.112.0/25', '192.169.112.128/25', '192.169.120.0/25', '192.169.120.128/25', '192.169.128.0/25', '192.169.128.128/25', '192.169.136.0/25', '192.169.136.128/25', '192.169.144.0/25', '192.16
Failure results: {{
    "": {
        "missed_FRR_routes": [
            {
                "destSelected": true,
                "distance": 20,
                "failed": true,
                "installedNexthopGroupId": 39146,
                "internalFlags": 8,
                "internalNextHopActiveNum": 4,
                "internalNextHopNum": 4,
                "internalStatus": 168,
                "metric": 0,
                "nexthopGroupId": 39146,
                "nexthops": [
                    {
                        "active": true,
                        "afi": "ipv4",
                        "fib": true,
                        "flags": 3,
                        "interfaceIndex": 6,
                        "interfaceName": "PortChannel102",
                        "ip": "10.0.0.1",
                        "rmapSource": "10.1.0.32",
                        "weight": 1
                    },
                    {
                        "active": true,

Failed. Look at reported mismatches above

Signed-off-by: Priyansh Tratiya <[email protected]>
vmittal-msft pushed a commit that referenced this pull request Mar 17, 2026
What I did
It supports to detect the route with offload False or without offload, which can capture queued route, because queued route doesn’t have offload, but for rejected route, the offload is True. It can’t detect the rejected route.
So, we add a new detection check for the value of key failed for route entries, which can cover both rejected and queued routes.
It will help to detect rejected route and queued route on device.

How I did it
Append failed route prefix into failed list, if it's not empty, script will print error message into syslog

        # Check for failed state
        if entry.get('failed', False):
            failed_rt.append(route_prefix)
How to verify it
For rejected route:
The output of route_check.py

Some routes have failed state in FRR : ['0.0.0.0/0', '192.168.128.0/25', '192.168.128.128/25', '192.168.136.0/25', '192.168.136.128/25', '192.168.144.0/25', '192.168.144.128/25', '192.168.152.0/25', '192.168.152.128/25', '192.168.160.0/25', '192.168.160.128/25', '192.168.168.0/25', '192.168.168.128/25', '192.168.176.0/25', '192.168.176.128/25', '192.168.184.0/25', '192.168.184.128/25', '192.168.192.0/25', '192.168.192.128/25', '192.168.200.0/25', '192.168.200.128/25', '192.168.208.0/25', '192.168.208.128/25', '192.168.216.0/25', '192.168.216.128/25', '192.168.224.0/25', '192.168.224.128/25', '192.168.232.0/25', '192.168.232.128/25', '192.168.240.0/25', '192.168.240.128/25', '192.168.248.0/25', '192.168.248.128/25', '192.169.0.0/25', '192.169.0.128/25', '192.169.104.0/25', '192.169.104.128/25', '192.169.112.0/25', '192.169.112.128/25', '192.169.120.0/25', '192.169.120.128/25', '192.169.128.0/25', '192.169.128.128/25', '192.169.136.0/25', '192.169.136.128/25', '192.169.144.0/25', '192.16
Failure results: {{
    "": {
        "failed_FRR_routes": [
            "0.0.0.0/0",
            "192.168.128.0/25",
            "192.168.128.128/25",
            "192.168.136.0/25",
            "192.168.136.128/25",
            "192.168.144.0/25",
            "192.168.144.128/25",
            "192.168.152.0/25",
            "192.168.152.128/25",
            "192.168.160.0/25",
            "192.168.160.128/25",
            "192.168.168.0/25",
            "192.168.168.128/25",
            "192.168.176.0/25",
            "192.168.176.128/25",
            "192.168.184.0/25",
            "192.168.184.128/25",
            "192.168.192.0/25",
            "192.168.192.128/25",
            "192.168.200.0/25",
            "192.168.200.128/25",
            "192.168.208.0/25",
            "192.168.208.128/25",
            "192.168.216.0/25",
            "192.168.216.128/25",
            "192.168.224.0/25",
            "192.168.224.128/25",
            "192.168.232.0/25",
            "192.168.232
Failed. Look at reported mismatches above
For rejected route:
the output of route_check.py

Some routes have failed state in FRR : ['0.0.0.0/0', '192.168.128.0/25', '192.168.128.128/25', '192.168.136.0/25', '192.168.136.128/25', '192.168.144.0/25', '192.168.144.128/25', '192.168.152.0/25', '192.168.152.128/25', '192.168.160.0/25', '192.168.160.128/25', '192.168.168.0/25', '192.168.168.128/25', '192.168.176.0/25', '192.168.176.128/25', '192.168.184.0/25', '192.168.184.128/25', '192.168.192.0/25', '192.168.192.128/25', '192.168.200.0/25', '192.168.200.128/25', '192.168.208.0/25', '192.168.208.128/25', '192.168.216.0/25', '192.168.216.128/25', '192.168.224.0/25', '192.168.224.128/25', '192.168.232.0/25', '192.168.232.128/25', '192.168.240.0/25', '192.168.240.128/25', '192.168.248.0/25', '192.168.248.128/25', '192.169.0.0/25', '192.169.0.128/25', '192.169.104.0/25', '192.169.104.128/25', '192.169.112.0/25', '192.169.112.128/25', '192.169.120.0/25', '192.169.120.128/25', '192.169.128.0/25', '192.169.128.128/25', '192.169.136.0/25', '192.169.136.128/25', '192.169.144.0/25', '192.16
Failure results: {{
    "": {
        "missed_FRR_routes": [
            {
                "destSelected": true,
                "distance": 20,
                "failed": true,
                "installedNexthopGroupId": 39146,
                "internalFlags": 8,
                "internalNextHopActiveNum": 4,
                "internalNextHopNum": 4,
                "internalStatus": 168,
                "metric": 0,
                "nexthopGroupId": 39146,
                "nexthops": [
                    {
                        "active": true,
                        "afi": "ipv4",
                        "fib": true,
                        "flags": 3,
                        "interfaceIndex": 6,
                        "interfaceName": "PortChannel102",
                        "ip": "10.0.0.1",
                        "rmapSource": "10.1.0.32",
                        "weight": 1
                    },
                    {
                        "active": true,

Failed. Look at reported mismatches above

Signed-off-by: Priyansh Tratiya <[email protected]>
Co-authored-by: Zhaohui Sun <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants