Skip to content

Format to add forced_mgmt_route with specific GW #1517

@shubav

Description

@shubav

For my ansible tests to work, I need to add the following route on my sonic-host dut in order to reach my PTF docker on the ansible hosts:

sudo ip route add 10.250.0.0/24 via 152.148.146.161 dev eth0 src 152.148.151.159

However, the "152.148.146.161" mentioned above is not a generic/default lab gateway but the mgmt ip of my ansible host.

admin@sonicHost:~$ sudo ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 152.148.151.159  netmask 255.255.248.0  broadcast 0.0.0.0
<snip>

admin@sonicHost:~$ ip route
default via 152.148.144.1 dev eth0 proto 196 metric 20 

I see there's a way we can add routes in group_vars/lab/lab.yml using the variable forced_mgmt_routes but I don't see an option of adding the gateway in templates/minigraph_meta.j2. The example https://github.com/Azure/SONiC/wiki/Configuration is not using the minigraph format either.

In other words, in the example above, I do not want to use the default GW of 152.148.144.1 for the 10.250.0.0/24 subnet.

So is there a way to specify the route and next-hop in a custom manner?

Thanks.

Description

Steps to reproduce the issue:
1.
2.
3.

Describe the results you received:

Describe the results you expected:

Additional information you deem important:

**Output of `show version`:**

```
(paste your output here)
```

**Attach debug file `sudo generate_dump`:**

```
(paste your output here)
```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions