[minigraph.py]: Force /128 prefix for server IPv6 loopbacks (#6524)

Meet the requirement for the MUX_CABLE table that IPv6 loopbacks have a /128 prefix

Note that this change only affects the MUX_CABLE table, all other tables continue to use the loopback address provided in minigraph.

Signed-off-by: Lawrence Lee <lawlee@microsoft.com>
This commit is contained in:
Lawrence Lee 2021-01-21 15:05:35 -08:00 committed by GitHub
parent be3c036794
commit 8729fdc9ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

View File

@ -1512,8 +1512,10 @@ def get_mux_cable_entries(mux_cable_ports, neighbors, devices):
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']
if 'lo_addr_v6' in devices[neighbor] and devices[neighbor]['lo_addr_v6'] is not None:
server_ipv6_lo_addr = devices[neighbor]['lo_addr_v6'].split('/')[0]
server_ipv6_lo_prefix = ipaddress.ip_network(UNICODE_TYPE(server_ipv6_lo_addr))
entry['server_ipv6'] = str(server_ipv6_lo_prefix)
mux_cable_table[intf] = entry
else:
print("Warning: no server IPv4 loopback found for {}, skipping mux cable table entry".format(neighbor))

View File

@ -303,7 +303,7 @@
<d5p1:IPPrefix>10.10.10.1/32</d5p1:IPPrefix>
</Address>
<AddressV6 xmlns:d5p1="Microsoft.Search.Autopilot.NetMux">
<d5p1:IPPrefix>fe80::0001/128</d5p1:IPPrefix>
<d5p1:IPPrefix>fe80::0001/80</d5p1:IPPrefix>
</AddressV6>
<ManagementAddress xmlns:d5p1="Microsoft.Search.Autopilot.NetMux">
<d5p1:IPPrefix>10.0.0.1/32</d5p1:IPPrefix>

View File

@ -165,7 +165,7 @@ class TestCfgGenCaseInsensitive(TestCase):
'server1': {
'hwsku': 'server-sku',
'lo_addr': '10.10.10.1/32',
'lo_addr_v6': 'fe80::0001/128',
'lo_addr_v6': 'fe80::0001/80',
'mgmt_addr': '10.0.0.1/32',
'type': 'Server'
},
@ -275,12 +275,12 @@ class TestCfgGenCaseInsensitive(TestCase):
'Ethernet4': {
'state': 'auto',
'server_ipv4': '10.10.10.1/32',
'server_ipv6': 'fe80::0001/128'
'server_ipv6': 'fe80::1/128'
},
'Ethernet8': {
'state': 'auto',
'server_ipv4': '10.10.10.2/32',
'server_ipv6': 'fe80::0002/128'
'server_ipv6': 'fe80::2/128'
}
}