Skip to content

Commit

Permalink
[minigraph.py]: Force /32 prefix for mux cable server IPv4 loopbacks (#…
Browse files Browse the repository at this point in the history
…6418)

Server IPv4 loopbacks do not always arrive with /32 prefix, which is a requirement for the MUX_CABLE table in config DB

Signed-off-by: Lawrence Lee <[email protected]>
  • Loading branch information
theasianpianist authored Jan 12, 2021
1 parent 8b82408 commit 6e63ecf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/sonic-config-engine/minigraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -1505,7 +1505,12 @@ def get_mux_cable_entries(mux_cable_ports, neighbors, devices):
entry = {}
neighbor = neighbors[intf]['name']
entry['state'] = 'auto'
entry['server_ipv4'] = devices[neighbor]['lo_addr']

# Always force a /32 prefix for server IPv4 loopbacks
server_ipv4_lo_addr = devices[neighbor]['lo_addr'].split("/")[0]
server_ipv4_lo_prefix = ipaddress.ip_network(UNICODE_TYPE(server_ipv4_lo_addr))
entry['server_ipv4'] = str(server_ipv4_lo_prefix)

if 'lo_addr_v6' in devices[neighbor]:
entry['server_ipv6'] = devices[neighbor]['lo_addr_v6']
mux_cable_table[intf] = entry
Expand Down

0 comments on commit 6e63ecf

Please sign in to comment.