From a7c53858618361011640d44db8cd88fefd9bef18 Mon Sep 17 00:00:00 2001 From: Andre Kantek Date: Mon, 22 Apr 2024 16:28:45 -0300 Subject: [PATCH] Dual-stack: generate pxeboot label without address ID mtcClient needs that the pxeboot interface config filename to contain the label "[network-id]" to find the pxeboot address by reading the file in /etc/network/interfaces.d/. During dual-stack development the format [net-id]-[addr-id] was adopted to differentiate files for each protocol (ipv4 and IPv6) in the same network. Since this broke mtcClient operation, we keeping the previous format to the pxeboot network, since it does not support dual-stack. Test Plan [PASS] Install AIO-DX with pxeboot, management and cluster-host on the same ethernet port and verify: - the system is up with no alarms. - the pxeboot config file does not contain "-N" suffix [PASS] Install AIO-DX with pxeboot, management and cluster-host on the same bonding port and verify: - the system is up with no alarms. - the pxeboot config file does not contain "-N" suffix [PASS] Install AIO-DX with pxeboot on the ethernet port, and management and cluster-host on a vlan port on top of it and verify: - the system is up with no alarms. - the pxeboot config file does not contain "-N" suffix Story: 2011027 Task: 49919 Change-Id: I42ab55d15c0df7d6a14377278b2f7624e83cb836 Signed-off-by: Andre Kantek --- .../sysinv/sysinv/sysinv/puppet/interface.py | 8 ++++++- .../sysinv/tests/puppet/test_interface.py | 21 +++++++++++-------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/sysinv/sysinv/sysinv/sysinv/puppet/interface.py b/sysinv/sysinv/sysinv/sysinv/puppet/interface.py index 3d27b7402b..be1648a2d8 100644 --- a/sysinv/sysinv/sysinv/sysinv/puppet/interface.py +++ b/sysinv/sysinv/sysinv/sysinv/puppet/interface.py @@ -1303,7 +1303,13 @@ def get_interface_network_config(context, iface, network=None, address=None): if network or address: net_num = network.id if network else 0 addr_num = address.id if address else 0 - ifname = "%s:%d-%d" % (os_ifname, net_num, addr_num) + if network and network.type == constants.NETWORK_TYPE_PXEBOOT: + # the name format for pxeboot does not need to contain the address id as + # this network does not have dual-stack support and MTCE uses the format + # below to identify the pxeboot address + ifname = "%s:%d" % (os_ifname, net_num) + else: + ifname = "%s:%d-%d" % (os_ifname, net_num, addr_num) else: ifname = os_ifname diff --git a/sysinv/sysinv/sysinv/sysinv/tests/puppet/test_interface.py b/sysinv/sysinv/sysinv/sysinv/tests/puppet/test_interface.py index 77966b1e49..91735da778 100644 --- a/sysinv/sysinv/sysinv/sysinv/tests/puppet/test_interface.py +++ b/sysinv/sysinv/sysinv/sysinv/tests/puppet/test_interface.py @@ -2469,7 +2469,7 @@ class InterfaceControllerEthernet(InterfaceHostTestCase): 'tc': False}, "eth1": {'family': 'inet', 'method': 'manual', 'stx-description': f'ifname:mgmt,net:{None}', 'tc': True}, - "eth1:1-3": {'family': 'inet', 'method': 'static', + "eth1:1": {'family': 'inet', 'method': 'static', 'stx-description': f'ifname:mgmt,net:{constants.NETWORK_TYPE_PXEBOOT}', 'tc': False}, "eth1:2-7": {'family': 'inet', 'method': 'static', @@ -2513,7 +2513,7 @@ class InterfaceControllerEthernetCfg2(InterfaceHostTestCase): 'tc': False}, "eth1": {'family': 'inet', 'method': 'manual', 'stx-description': f'ifname:mgmt0,net:{None}', 'tc': True}, - "eth1:1-3": {'family': 'inet', 'method': 'static', + "eth1:1": {'family': 'inet', 'method': 'static', 'stx-description': f'ifname:mgmt0,net:{constants.NETWORK_TYPE_PXEBOOT}', 'tc': False}, "eth1:2-7": {'family': 'inet', 'method': 'static', @@ -2558,7 +2558,7 @@ class InterfaceControllerEthernetCfg3(InterfaceHostTestCase): 'tc': False}, "eth1": {'family': 'inet', 'method': 'manual', 'stx-description': f'ifname:mgmt0,net:{None}', 'tc': True}, - "eth1:1-3": {'family': 'inet', 'method': 'static', + "eth1:1": {'family': 'inet', 'method': 'static', 'stx-description': f'ifname:mgmt0,net:{constants.NETWORK_TYPE_PXEBOOT}', 'tc': False}, "eth1:2-7": {'family': 'inet', 'method': 'static', @@ -2622,7 +2622,7 @@ class InterfaceControllerBond(InterfaceHostTestCase): 'tc': False}, "mgmt0": {'family': 'inet', 'method': 'manual', 'stx-description': f'ifname:mgmt0,net:{None}', 'tc': True}, - "mgmt0:1-3": {'family': 'inet', 'method': 'static', + "mgmt0:1": {'family': 'inet', 'method': 'static', 'stx-description': f'ifname:mgmt0,net:{constants.NETWORK_TYPE_PXEBOOT}', 'tc': False}, "mgmt0:2-7": {'family': 'inet', 'method': 'static', @@ -2768,7 +2768,7 @@ class InterfaceComputeEthernet(InterfaceHostTestCase): self.exp_yaml_config = { "eth0": {'family': 'inet', 'method': 'manual', 'stx-description': f'ifname:mgmt,net:{None}', 'tc': True}, - "eth0:1-0": {'family': 'inet', 'method': 'dhcp', + "eth0:1": {'family': 'inet', 'method': 'dhcp', 'stx-description': f'ifname:mgmt,net:{constants.NETWORK_TYPE_PXEBOOT}', 'tc': False}, "eth0:2-37": {'family': 'inet', 'method': 'static', @@ -2838,7 +2838,7 @@ class InterfaceComputeEthernetCfg2(InterfaceHostTestCase): self.exp_yaml_config = { "eth0": {'family': 'inet', 'method': 'manual', 'stx-description': f'ifname:mgmt,net:{None}', 'tc': True}, - "eth0:1-0": {'family': 'inet', 'method': 'dhcp', + "eth0:1": {'family': 'inet', 'method': 'dhcp', 'stx-description': f'ifname:mgmt,net:{constants.NETWORK_TYPE_PXEBOOT}', 'tc': False}, "eth0:2-37": {'family': 'inet', 'method': 'static', @@ -2911,7 +2911,7 @@ class InterfaceComputeEthernetCfg3(InterfaceHostTestCase): 'tc': True}, "eth1": {'family': 'inet', 'method': 'manual', 'stx-description': f'ifname:cluster-host,net:{None}', 'tc': False}, - "eth1:1-0": {'family': 'inet', 'method': 'dhcp', + "eth1:1": {'family': 'inet', 'method': 'dhcp', 'stx-description': f'ifname:cluster-host,net:{constants.NETWORK_TYPE_PXEBOOT}', 'tc': False}, "eth1:4-38": {'family': 'inet', 'method': 'static', @@ -3114,7 +3114,7 @@ class InterfaceComputeBond(InterfaceHostTestCase): 'stx-description': f'ifname:eth1,net:{None}', 'tc': False}, "mgmt": {'family': 'inet', 'method': 'manual', 'stx-description': f'ifname:mgmt,net:{None}', 'tc': True}, - "mgmt:1-0": {'family': 'inet', 'method': 'dhcp', + "mgmt:1": {'family': 'inet', 'method': 'dhcp', 'stx-description': f'ifname:mgmt,net:{constants.NETWORK_TYPE_PXEBOOT}', 'tc': False}, "mgmt:2-37": {'family': 'inet', 'method': 'static', @@ -3859,7 +3859,10 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin): if base: ifname = kernelname else: - ifname = f"{kernelname}:{network.id if network else 0}-{address.id if address else 0}" + if network and network.type == constants.NETWORK_TYPE_PXEBOOT: + ifname = f"{kernelname}:{network.id if network else 0}" + else: + ifname = f"{kernelname}:{network.id if network else 0}-{address.id if address else 0}" return {ifname: config}