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

pbr: fix nexthop-group json output #16949

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Sep 27, 2024

  1. pbr: format change in nexthop-group json output

     - JSON format is changed.
    	currently json output returns as array format,
            in which we cannot add extra attributes under it.
       	so, we modified the JSON format into dict.
     - Added nhgCount into vtysh "show pbr nexthop-groups json".
     - Addressed interface-name & vrf-id issues.
    	currently, "vrfId" is mapped with interface name.
    
    supported commands:
    
    ```
    show pbr nexthop-groups json
    show pbr nexthop-groups <nh-grp> json
    ```
    
    Ticket:#3963583
    
    Issue: 3963583
    
    Testing:
    
    Before fix:
    
    leaf12# show pbr nexthop-groups json
    [
      {
        "id":10001,
        "name":"nh-grp-2",
        "valid":true,
        "installed":false,
        "nexthops":[
          {
            "nexthop":"12.10.10.1",
            "vrfId":"swp1", ====> wrongly mapped
            "valid":true
          }
        ]
      },
      {
        "id":10000,
        "name":"nh-grp-1",
        "valid":false,
        "installed":false,
        "nexthops":[
          {
            "nexthop":"11.10.10.1",
            "vrfId":"lo", ====> wrongly mapped
            "valid":false
          }
        ]
      }
    ]
    
    After fix:
    
    leaf11# show pbr nexthop-groups nh-grp-1 json
    {
      "10000":{
        "id":10000,
        "name":"nh-grp-1",
        "valid":false,
        "installed":false,
        "nexthops":[
          {
            "nexthop":"11.10.10.1",
            "valid":false
          },
          {
            "nexthop":"2.2.2.1",
            "interfaceName":"swp1",
            "vrfId":0,
            "valid":false
          }
        ]
      },
      "nhgCount":1
    }
    
    Signed-off-by: Sindhu Parvathi Gopinathan's <[email protected]>
    Sindhu Parvathi Gopinathan authored and chiragshah6 committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    86ca722 View commit details
    Browse the repository at this point in the history