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

[debug dump util] Route Module added #1913

Merged
merged 14 commits into from
Nov 22, 2021

Conversation

vivekrnv
Copy link
Contributor

@vivekrnv vivekrnv commented Nov 6, 2021

Signed-off-by: Vivek Reddy Karri vkarri@nvidia.com

What I did

HLD for Dump Utility: HLD.

  • Added the Route Module to the Debug Dump Utility
  • Added the Corresponding UT's

How I did it

How to verify it

tests/dump_tests/module_tests/route_test.py::TestRouteModule::test_all_args PASSED                                                                                                                                                    [ 11%]
tests/dump_tests/module_tests/route_test.py::TestRouteModule::test_caching_redis_keys PASSED                                                                                                                                          [ 22%]
tests/dump_tests/module_tests/route_test.py::TestRouteModule::test_directly_connected_route PASSED                                                                                                                                    [ 33%]
tests/dump_tests/module_tests/route_test.py::TestRouteModule::test_ip2me_route PASSED                                                                                                                                                 [ 44%]
tests/dump_tests/module_tests/route_test.py::TestRouteModule::test_no_next_hop_id PASSED                                                                                                                                              [ 55%]
tests/dump_tests/module_tests/route_test.py::TestRouteModule::test_no_route_entry PASSED                                                                                                                                              [ 66%]
tests/dump_tests/module_tests/route_test.py::TestRouteModule::test_route_with_next_hop PASSED                                                                                                                                         [ 77%]
tests/dump_tests/module_tests/route_test.py::TestRouteModule::test_route_with_next_hop_group PASSED                                                                                                                                   [ 88%]
tests/dump_tests/module_tests/route_test.py::TestRouteModule::test_static_route PASSED   

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)

admin@r-tigon-11:~$ dump state route 200.0.1.0/26
{
    "200.0.1.0/26": {
        "APPL_DB": {
            "keys": [
                {
                    "ROUTE_TABLE:200.0.1.0/26": {
                        "ifname": "PortChannel0004,PortChannel0007",
                        "nexthop": "10.0.0.37,10.0.0.41"
                    }
                }
            ],
            "tables_not_found": []
        },
        "ASIC_DB": {
            "keys": [
                {
                    "ASIC_STATE:SAI_OBJECT_TYPE_ROUTE_ENTRY:{\"dest\":\"200.0.1.0/26\",\"switch_id\":\"oid:0x21000000000000\",\"vr\":\"oid:0x3000000000002\"}": {
                        "SAI_ROUTE_ENTRY_ATTR_NEXT_HOP_ID": "oid:0x5000000000c92"
                    }
                },
                {
                    "ASIC_STATE:SAI_OBJECT_TYPE_VIRTUAL_ROUTER:oid:0x3000000000002": {
                        "NULL": "NULL"
                    }
                },
                {
                    "ASIC_STATE:SAI_OBJECT_TYPE_NEXT_HOP_GROUP:oid:0x5000000000c92": {
                        "SAI_NEXT_HOP_GROUP_ATTR_TYPE": "SAI_NEXT_HOP_GROUP_TYPE_DYNAMIC_UNORDERED_ECMP"
                    }
                },
                {
                    "ASIC_STATE:SAI_OBJECT_TYPE_NEXT_HOP_GROUP:oid:0x5000000000c72": {
                        "SAI_NEXT_HOP_GROUP_ATTR_TYPE": "SAI_NEXT_HOP_GROUP_TYPE_DYNAMIC_UNORDERED_ECMP"
                    }
                },
                {
                    "ASIC_STATE:SAI_OBJECT_TYPE_NEXT_HOP_GROUP:oid:0x5000000000c4f": {
                        "SAI_NEXT_HOP_GROUP_ATTR_TYPE": "SAI_NEXT_HOP_GROUP_TYPE_DYNAMIC_UNORDERED_ECMP"
                    }
                },
                {
                    "ASIC_STATE:SAI_OBJECT_TYPE_NEXT_HOP_GROUP:oid:0x5000000000c57": {
                        "SAI_NEXT_HOP_GROUP_ATTR_TYPE": "SAI_NEXT_HOP_GROUP_TYPE_DYNAMIC_UNORDERED_ECMP"
                    }
                },
                {
                    "ASIC_STATE:SAI_OBJECT_TYPE_NEXT_HOP_GROUP_MEMBER:oid:0x2d000000000c94": {
                        "SAI_NEXT_HOP_GROUP_MEMBER_ATTR_NEXT_HOP_GROUP_ID": "oid:0x5000000000c92",
                        "SAI_NEXT_HOP_GROUP_MEMBER_ATTR_NEXT_HOP_ID": "oid:0x4000000000c49"
                    }
                },
                {
                    "ASIC_STATE:SAI_OBJECT_TYPE_NEXT_HOP_GROUP_MEMBER:oid:0x2d000000000c93": {
                        "SAI_NEXT_HOP_GROUP_MEMBER_ATTR_NEXT_HOP_GROUP_ID": "oid:0x5000000000c92",
                        "SAI_NEXT_HOP_GROUP_MEMBER_ATTR_NEXT_HOP_ID": "oid:0x4000000000c1c"
                    }
                },
                {
                    "ASIC_STATE:SAI_OBJECT_TYPE_NEXT_HOP:oid:0x4000000000c49": {
                        "SAI_NEXT_HOP_ATTR_IP": "10.0.0.41",
                        "SAI_NEXT_HOP_ATTR_ROUTER_INTERFACE_ID": "oid:0x6000000000b47",
                        "SAI_NEXT_HOP_ATTR_TYPE": "SAI_NEXT_HOP_TYPE_IP"
                    }
                },
                {
                    "ASIC_STATE:SAI_OBJECT_TYPE_NEXT_HOP:oid:0x4000000000c1c": {
                        "SAI_NEXT_HOP_ATTR_IP": "10.0.0.37",
                        "SAI_NEXT_HOP_ATTR_ROUTER_INTERFACE_ID": "oid:0x6000000000b44",
                        "SAI_NEXT_HOP_ATTR_TYPE": "SAI_NEXT_HOP_TYPE_IP"
                    }
                },
                {
                    "ASIC_STATE:SAI_OBJECT_TYPE_ROUTER_INTERFACE:oid:0x6000000000b47": {
                        "SAI_ROUTER_INTERFACE_ATTR_MTU": "9100",
                        "SAI_ROUTER_INTERFACE_ATTR_PORT_ID": "oid:0x2000000000b1f",
                        "SAI_ROUTER_INTERFACE_ATTR_SRC_MAC_ADDRESS": "1C:34:DA:1D:EA:00",
                        "SAI_ROUTER_INTERFACE_ATTR_TYPE": "SAI_ROUTER_INTERFACE_TYPE_PORT",
                        "SAI_ROUTER_INTERFACE_ATTR_VIRTUAL_ROUTER_ID": "oid:0x3000000000002"
                    }
                },
                {
                    "ASIC_STATE:SAI_OBJECT_TYPE_ROUTER_INTERFACE:oid:0x6000000000b44": {
                        "SAI_ROUTER_INTERFACE_ATTR_MTU": "9100",
                        "SAI_ROUTER_INTERFACE_ATTR_PORT_ID": "oid:0x2000000000b1c",
                        "SAI_ROUTER_INTERFACE_ATTR_SRC_MAC_ADDRESS": "1C:34:DA:1D:EA:00",
                        "SAI_ROUTER_INTERFACE_ATTR_TYPE": "SAI_ROUTER_INTERFACE_TYPE_PORT",
                        "SAI_ROUTER_INTERFACE_ATTR_VIRTUAL_ROUTER_ID": "oid:0x3000000000002"
                    }
                }
            ],
            "tables_not_found": [],
            "vidtorid": {
                "oid:0x3000000000002": "oid:0x3",
                "oid:0x5000000000c92": "oid:0x3900000005",
                "oid:0x5000000000c72": "oid:0x3800000005",
                "oid:0x5000000000c4f": "oid:0x3300000005",
                "oid:0x5000000000c57": "oid:0x3500000005",
                "oid:0x2d000000000c94": "oid:0x3000390000002d",
                "oid:0x2d000000000c93": "oid:0x500390000002d",
                "oid:0x4000000000c49": "oid:0x3000000004",
                "oid:0x4000000000c1c": "oid:0x500000004",
                "oid:0x6000000000b47": "oid:0x1c100000006",
                "oid:0x6000000000b44": "oid:0x10100000006"
            }
        }
    }
}

Signed-off-by: Vivek Reddy Karri <vkarri@nvidia.com>
Signed-off-by: Vivek Reddy Karri <vkarri@nvidia.com>
Signed-off-by: Vivek Reddy Karri <vkarri@nvidia.com>
Signed-off-by: Vivek Reddy Karri <vkarri@nvidia.com>
Signed-off-by: Vivek Reddy Karri <vkarri@nvidia.com>
@lgtm-com
Copy link

lgtm-com bot commented Nov 6, 2021

This pull request introduces 1 alert when merging 8b9228b into 563c416 - view on LGTM.com

new alerts:

  • 1 for Unused import

dgsudharsan
dgsudharsan previously approved these changes Nov 10, 2021
@vivekrnv
Copy link
Contributor Author

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@dgsudharsan
Copy link
Collaborator

@prsunny @SuvarnaMeenakshi Can you please review?

@rlhui
Copy link
Contributor

rlhui commented Nov 18, 2021

@TACappleman - would you please review? Thanks.

self.init_asic_nh()
return self.ret_temp

def add_to_ret_template(self, table, db, keys, err, add_to_tables_not_found=True):
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be made a method on the Executor class, to avoid needing to redefine each time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's another such refactoring request here: #1853 (comment),

I'll also do this after once the Route and VxLan modules are merged. It'll be cleaner that way

dump/plugins/route.py Outdated Show resolved Hide resolved
dump/plugins/route.py Outdated Show resolved Hide resolved
return key_dict.get("vr", "")


class NextHopGroupMatchOptimizer():
Copy link
Contributor

Choose a reason for hiding this comment

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

All of this is generic code that may be useful for other plugins in future (you're already also using it for VRF IDs) so put in a common place

return "*\"dest\":\"" + dest + "\"*"


def get_vr_oid(asic_route_entry):
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment to document expectations of route entry format

@lgtm-com
Copy link

lgtm-com bot commented Nov 20, 2021

This pull request introduces 1 alert when merging ac92cdd into ac8382f - view on LGTM.com

new alerts:

  • 1 for Unused import

@vivekrnv
Copy link
Contributor Author

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@vivekrnv
Copy link
Contributor Author

@TACappleman, I've addressed the comments. Please review them

@prsunny prsunny merged commit 02a98ef into sonic-net:master Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants